1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Raise error for missing wiki folders

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
This commit is contained in:
Jermolene 2014-10-18 19:39:39 +01:00
parent 9a4bda9c85
commit 744245ea32

View File

@ -1714,7 +1714,9 @@ $tw.boot.startup = function(options) {
// If the first command line argument doesn't start with `--` then we // 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 // interpret it as the path to the wiki folder, which will otherwise default
// to the current folder // to the current folder
var explicitWikiPath;
if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) { if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) {
explicitWikiPath = true;
$tw.boot.wikiPath = $tw.boot.argv[0]; $tw.boot.wikiPath = $tw.boot.argv[0];
$tw.boot.argv = $tw.boot.argv.slice(1); $tw.boot.argv = $tw.boot.argv.slice(1);
} else { } else {
@ -1761,6 +1763,9 @@ $tw.boot.startup = function(options) {
$tw.loadTiddlersBrowser(); $tw.loadTiddlersBrowser();
} else { } else {
$tw.loadTiddlersNode(); $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 // Unpack plugin tiddlers
$tw.wiki.readPluginInfo(); $tw.wiki.readPluginInfo();