1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 06:14:44 +00:00

makelibrary command: Guard against invalid directories

This commit is contained in:
jeremy@jermolene.com 2020-04-20 12:58:27 +01:00
parent 678e25f510
commit 5688670da6

View File

@ -33,7 +33,7 @@ Command.prototype.execute = function() {
tiddlers = {}; tiddlers = {};
// Collect up the library plugins // Collect up the library plugins
var collectPlugins = function(folder) { var collectPlugins = function(folder) {
var pluginFolders = $tw.utils.getSubdirectories(folder); var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
for(var p=0; p<pluginFolders.length; p++) { for(var p=0; p<pluginFolders.length; p++) {
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) { if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p])); pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
@ -44,7 +44,7 @@ Command.prototype.execute = function() {
} }
}, },
collectPublisherPlugins = function(folder) { collectPublisherPlugins = function(folder) {
var publisherFolders = $tw.utils.getSubdirectories(folder); var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
for(var t=0; t<publisherFolders.length; t++) { for(var t=0; t<publisherFolders.length; t++) {
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) { if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
collectPlugins(path.resolve(folder,"./" + publisherFolders[t])); collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));