summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2012-06-28 15:58:28 +0200
committerMarcel Klehr <mklehr@gmx.net>2012-06-28 15:58:28 +0200
commitb0d369883b17d8ab60eff0738f2f4ec8bb82e29f (patch)
tree8cf1f484631476d9b266427c08b70c4527602f06
parent711dee8f6b3f2c858d48d987e11ff587fb9ebfc6 (diff)
downloadetherpad-lite-b0d369883b17d8ab60eff0738f2f4ec8bb82e29f.zip
Fix plugin loader to work with windows paths (e.g. 'D:\foo\...')
-rw-r--r--src/static/js/pluginfw/plugins.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js
index 1d486223..455dd203 100644
--- a/src/static/js/pluginfw/plugins.js
+++ b/src/static/js/pluginfw/plugins.js
@@ -54,10 +54,22 @@ exports.formatHooks = function (hook_set_name) {
};
exports.loadFn = function (path, hookName) {
- var x = path.split(":");
- var fn = require(x[0]);
- var functionName = x[1] ? x[1] : hookName;
+ var functionName
+ , parts = path.split(":");
+ // on windows
+ if(process.platform == 'win32') {
+ if(parts.length == 3)
+ functionName = parts.pop();
+ path = parts.join(":");
+ }else{
+ path = parts[0];
+ functionName = parts[1];
+ }
+
+ var fn = require(path);
+ functionName = functionName ? functionName : hookName;
+
_.each(functionName.split("."), function (name) {
fn = fn[name];
});