From faf856ba8e45de1d725d01e7e0bb27a1ae236ea2 Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 31 Jul 2010 07:29:25 +0000 Subject: getRuntimeDirectories を○ックするように git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38075 d0d07461-0603-4401-acd4-de1884942a52 --- plugin_loader.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'plugin_loader.js') diff --git a/plugin_loader.js b/plugin_loader.js index 8b62c44..675bcd3 100644 --- a/plugin_loader.js +++ b/plugin_loader.js @@ -70,6 +70,28 @@ let PLUGIN_INFO = : obj.toString().split(/[,| \t\r\n]+/); } + function around () { + liberator.plugins.libly.$U.around( + io, + 'getRuntimeDirectories', + function (next, [path]) { + let dirs = next(); + // XXX Win 以外でも \\ を考慮しちゃうつ + let [m, dirname] = path.match(/^plugin[\/\\]?(.*)$/) || []; + if (m) { + roots.forEach(function (root) { + let rf = io.File(root); + if (dirname) + rf.append(dirname); + if (rf.exists() && rf.isDirectory()) + dirs.push(rf); + }); + } + return dirs; + } + ); + } + let roots = toArray(liberator.globalVariables.plugin_loader_roots).map(io.expandPath); let plugins = toArray(liberator.globalVariables.plugin_loader_plugins); let filter = new RegExp('[\\\\/](?:' + @@ -79,6 +101,8 @@ let PLUGIN_INFO = liberator.log('plugin_loader: loading'); + let arounded = false; + roots.forEach(function (root) { let dir = io.File(root); if (dir.exists() && dir.isDirectory() && dir.isReadable()) { @@ -94,6 +118,10 @@ let PLUGIN_INFO = } else { liberator.echoerr('plugin_loader.js: context not found (' + file.path + ')'); } + if (!arounded && file.leafName === '_libly.js') { + arounded = true; + around(); + } } }); } else { -- cgit v1.2.3