1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-27 02:20:28 +00:00

Add a warning for tiddlywiki.info or plugin.info having json errors

This commit is contained in:
jeremy@jermolene.com 2023-06-02 10:41:42 +01:00
parent a371ea0555
commit 48b22abdaa

View File

@ -2080,7 +2080,11 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
console.log("Warning: missing plugin.info file in " + filepath);
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
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
// Save the plugin tiddlers into the plugin info
@ -2197,7 +2201,11 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
pluginFields;
// Bail if we don't have a wiki info file
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 {
return null;
}