mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
Fix plugin loader to work with windows paths (e.g. 'D:\foo\...')
This commit is contained in:
parent
711dee8f6b
commit
b0d369883b
1 changed files with 15 additions and 3 deletions
|
@ -54,9 +54,21 @@ exports.formatHooks = function (hook_set_name) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.loadFn = function (path, hookName) {
|
exports.loadFn = function (path, hookName) {
|
||||||
var x = path.split(":");
|
var functionName
|
||||||
var fn = require(x[0]);
|
, parts = path.split(":");
|
||||||
var functionName = x[1] ? x[1] : hookName;
|
|
||||||
|
// 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) {
|
_.each(functionName.split("."), function (name) {
|
||||||
fn = fn[name];
|
fn = fn[name];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue