From bb32ae917ccf2697dbc3669a0abb218a4c8b0f8b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 16 Oct 2008 00:19:03 +0000 Subject: [PATCH] Fix plugin loading --- content/liberator.js | 48 +++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/content/liberator.js b/content/liberator.js index ea849c79..7552dc50 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -908,33 +908,31 @@ const liberator = (function () //{{{ { let dirs = io.getRuntimeDirectories("plugin"); - if (dirs.length > 0) - { - for (let [,dir] in Iterator(dirs)) - { - // TODO: search plugins/**/* for plugins - liberator.echomsg("Searching for \"plugin/*.{js,vimp}\" in \"" + dir.path + "\"", 2); - - liberator.log("Sourcing plugin directory: " + dir.path + "...", 3); - - let files = io.readDirectory(dir.path, true); - - files.forEach(function (file) { - if (!file.isDirectory() && /\.(js|vimp)$/i.test(file.path) && !(file.path in pluginFiles)) - { - try - { - io.source(file.path, false); - pluginFiles[file.path] = true; - } - catch (e) {}; - } - }); - } - } - else + if (dirs.length == 0) { liberator.log("No user plugin directory found", 3); + return; + } + for (let [,dir] in Iterator(dirs)) + { + // TODO: search plugins/**/* for plugins + liberator.echomsg("Searching for \"plugin/*.{js,vimp}\" in \"" + dir.path + "\"", 2); + + liberator.log("Sourcing plugin directory: " + dir.path + "...", 3); + + let files = io.readDirectory(dir.path, true); + + files.forEach(function (file) { + if (!file.isDirectory() && /\.(js|vimp)$/i.test(file.path) && !(file.path in liberator.pluginFiles)) + { + try + { + io.source(file.path, false); + liberator.pluginFiles[file.path] = true; + } + catch (e) {}; + } + }); } } catch (e)