From 744245ea3249446fd15f504190efb1d828935d01 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 18 Oct 2014 19:39:39 +0100 Subject: [PATCH] Raise error for missing wiki folders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only raise the error if the wiki path is explicitly specified on the command line, avoiding `tiddlywiki —version` raising an error if the current directory isn’t a wiki folder. Fixes #990 --- boot/boot.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boot/boot.js b/boot/boot.js index 98c888079..d96e82222 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1714,7 +1714,9 @@ $tw.boot.startup = function(options) { // If the first command line argument doesn't start with `--` then we // interpret it as the path to the wiki folder, which will otherwise default // to the current folder + var explicitWikiPath; if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) { + explicitWikiPath = true; $tw.boot.wikiPath = $tw.boot.argv[0]; $tw.boot.argv = $tw.boot.argv.slice(1); } else { @@ -1761,6 +1763,9 @@ $tw.boot.startup = function(options) { $tw.loadTiddlersBrowser(); } else { $tw.loadTiddlersNode(); + if(!$tw.boot.wikiInfo && explicitWikiPath) { + return $tw.utils.error("Wiki folder '" + $tw.boot.wikiPath + "' is missing a 'tiddlywiki.info' file"); + } } // Unpack plugin tiddlers $tw.wiki.readPluginInfo();