From 823ed6313e876c044f47e72e63d3aa3cea421366 Mon Sep 17 00:00:00 2001 From: secondlife Date: Mon, 2 Mar 2009 02:15:13 +0000 Subject: root ディレクトリが無い場合の処理を追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30684 d0d07461-0603-4401-acd4-de1884942a52 --- plugin_loader.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'plugin_loader.js') diff --git a/plugin_loader.js b/plugin_loader.js index 166ff4d..2a2e1d6 100644 --- a/plugin_loader.js +++ b/plugin_loader.js @@ -80,13 +80,18 @@ let PLUGIN_INFO = liberator.log('plugin_loader: loading'); roots.forEach(function (root) { - let files = io.readDirectory(io.getFile(root), true); - files.forEach(function (file) { - if (filter.test(file.path)) { - liberator.log("Sourcing: " + file.path); - io.source(file.path, false); - } - }); + let dir = io.getFile(root); + if (dir.exists() && dir.isDirectory() && dir.isReadable()) { + let files = io.readDirectory(dir, true); + files.forEach(function (file) { + if (filter.test(file.path)) { + liberator.log("Sourcing: " + file.path); + io.source(file.path, false); + } + }); + } else { + liberator.log("Directory not found: " + dir.path); + } }); liberator.log('plugin_loader: loaded'); -- cgit v1.2.3