Give a warning message for missing plugin.info files

This commit is contained in:
Jermolene 2017-09-12 15:53:52 +01:00
parent 11da58355e
commit 378e00aee8
1 changed files with 6 additions and 1 deletions

View File

@ -1638,9 +1638,14 @@ Load the tiddlers from a plugin folder, and package them up into a proper JSON p
*/
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
var infoPath = filepath + path.sep + "plugin.info";
if(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {
// Read the plugin information
var pluginInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "plugin.info","utf8"));
if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {
console.log("Warning: missing plugin.info file in " + filepath);
return null;
}
var pluginInfo = JSON.parse(fs.readFileSync(infoPath,"utf8"));
// Read the plugin files
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
// Save the plugin tiddlers into the plugin info