mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-08 06:43:49 +00:00
Add a warning for tiddlywiki.info or plugin.info having json errors
This commit is contained in:
parent
a371ea0555
commit
48b22abdaa
12
boot/boot.js
12
boot/boot.js
@ -2080,7 +2080,11 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
console.log("Warning: missing plugin.info file in " + filepath);
|
console.log("Warning: missing plugin.info file in " + filepath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"));
|
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),function() {return null;});
|
||||||
|
if(!pluginInfo) {
|
||||||
|
console.log("warning: invalid JSON in plugin.info file at " + infoPath);
|
||||||
|
pluginInfo = {};
|
||||||
|
}
|
||||||
// Read the plugin files
|
// Read the plugin files
|
||||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||||
// Save the plugin tiddlers into the plugin info
|
// Save the plugin tiddlers into the plugin info
|
||||||
@ -2197,7 +2201,11 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
pluginFields;
|
pluginFields;
|
||||||
// Bail if we don't have a wiki info file
|
// Bail if we don't have a wiki info file
|
||||||
if(fs.existsSync(wikiInfoPath)) {
|
if(fs.existsSync(wikiInfoPath)) {
|
||||||
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"));
|
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"),function() {return null;});
|
||||||
|
if(!wikiInfo) {
|
||||||
|
console.log("warning: invalid JSON in tiddlywiki.info file at " + wikiInfoPath);
|
||||||
|
wikiInfo = {};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user