From 38081b86c97a795420515156fcd52177574be516 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 21 Aug 2024 18:56:34 +0100 Subject: [PATCH] Filesystem adaptor should not crash with missing wiki folder --- plugins/tiddlywiki/filesystem/filesystemadaptor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/filesystem/filesystemadaptor.js b/plugins/tiddlywiki/filesystem/filesystemadaptor.js index 5e704031e..451928101 100644 --- a/plugins/tiddlywiki/filesystem/filesystemadaptor.js +++ b/plugins/tiddlywiki/filesystem/filesystemadaptor.js @@ -22,7 +22,9 @@ function FileSystemAdaptor(options) { this.boot = options.boot || $tw.boot; this.logger = new $tw.utils.Logger("filesystem",{colour: "blue"}); // Create the /tiddlers folder if it doesn't exist - $tw.utils.createDirectory(this.boot.wikiTiddlersPath); + if(this.boot.wikiTiddlersPath) { + $tw.utils.createDirectory(this.boot.wikiTiddlersPath); + } } FileSystemAdaptor.prototype.name = "filesystem"; @@ -52,6 +54,10 @@ The type is found by looking up the extension in $tw.config.fileExtensionInfo (e It is the responsibility of the filesystem adaptor to update this.boot.files for new files that are created. */ FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) { + // Error if we don't have a this.boot.wikiTiddlersPath + if(!this.boot.wikiTiddlersPath) { + return callback("filesystemadaptor requires a valid wiki folder"); + } // Always generate a fileInfo object when this fuction is called var title = tiddler.fields.title, newInfo, pathFilters, extFilters, fileInfo = this.boot.files[title];