mirror of https://gitee.com/bigwinds/arangodb
parent
56054d3e66
commit
1a5f4c98f2
|
@ -1082,25 +1082,34 @@ function require (path) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to load the file
|
// try to load the file
|
||||||
var n;
|
var n;
|
||||||
|
|
||||||
if (p === "") {
|
if (p !== "" && p[p.length - 1] === '/') {
|
||||||
n = "." + main + ".js";
|
p = p.substr(0, p.length - 1);
|
||||||
}
|
|
||||||
else if (p[p.length - 1] === '/') {
|
|
||||||
n = p + main.substr(1) + ".js";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
n = p + main + ".js";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n = p + main + ".js";
|
||||||
if (fs.exists(n)) {
|
if (fs.exists(n)) {
|
||||||
return { name: main,
|
return { name: main,
|
||||||
path: 'file://' + n,
|
path: 'file://' + n,
|
||||||
content: fs.read(n) };
|
content: fs.read(n) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n = p + main + "/index.js";
|
||||||
|
if (fs.exists(n)) {
|
||||||
|
return { name: main,
|
||||||
|
path: 'file://' + n,
|
||||||
|
content: fs.read(n) };
|
||||||
|
}
|
||||||
|
|
||||||
|
n = p + main;
|
||||||
|
if (fs.exists(n)) {
|
||||||
|
return { name: main,
|
||||||
|
path: 'file://' + n,
|
||||||
|
content: fs.read(n) };
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue