mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-15 22:21:04 +00:00
Update app.js, lib/system.js
This commit is contained in:
parent
1d602b6ad8
commit
55297e9d1b
10
app.js
10
app.js
|
@ -95,15 +95,17 @@ function require(FN) {
|
||||||
|
|
||||||
// get directory name
|
// get directory name
|
||||||
var getDirName = function(path) {
|
var getDirName = function(path) {
|
||||||
var pos = path.lastIndexOf("\\");
|
var delimiter = "\\";
|
||||||
return path.substring(0, pos);
|
var pos = path.lastIndexOf(delimiter);
|
||||||
|
return (pos > -1 ? path.substring(0, pos) : "");
|
||||||
};
|
};
|
||||||
|
|
||||||
// get current script directory
|
// get current script directory
|
||||||
var getCurrentScriptDirectory = function() {
|
var getCurrentScriptDirectory = function() {
|
||||||
if (typeof(WScript) !== "undefined") {
|
if (typeof(WScript) !== "undefined") {
|
||||||
var path = WScript.ScriptFullName;
|
return getDirName(WScript.ScriptFullName);
|
||||||
return getDirName(path);
|
} else if (typeof(document) !== "undefined") {
|
||||||
|
return getDirName(document.location.pathname);
|
||||||
} else {
|
} else {
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,21 +99,33 @@ exports.getCurrentWorkingDirectory = function() {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// "console only";
|
exports.getDirName = function(path) {
|
||||||
|
var delimiter = "\\";
|
||||||
|
var pos = path.lastIndexOf(delimiter);
|
||||||
|
return (pos > -1 ? path.substring(0, pos) : "");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getFileName = function(path) {
|
||||||
|
var delimiter = "\\";
|
||||||
|
var pos = path.lastIndexOf(delimiter);
|
||||||
|
return (pos > -1 ? path.substring(pos + delimiter.length) : "");
|
||||||
|
};
|
||||||
|
|
||||||
exports.getCurrentScriptDirectory = function() {
|
exports.getCurrentScriptDirectory = function() {
|
||||||
if (typeof(WScript) !== "undefined") {
|
if (typeof(WScript) !== "undefined") {
|
||||||
var path = WScript.ScriptFullName;
|
return exports.getDirName(WScript.ScriptFullName);
|
||||||
var pos = path.lastIndexOf("\\");
|
} else if (typeof(document) !== "undefined") {
|
||||||
return path.substring(0, pos);
|
return exports.getDirName(document.location.pathname);
|
||||||
} else {
|
} else {
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// "console only";
|
|
||||||
exports.getCurrentScriptName = function() {
|
exports.getCurrentScriptName = function() {
|
||||||
if(typeof(WScript) !== "undefined") {
|
if(typeof(WScript) !== "undefined") {
|
||||||
return WScript.ScriptName;
|
return WScript.ScriptName;
|
||||||
|
} else if (typeof(document) !== "undefined") {
|
||||||
|
return exports.getFileName(document.location.pathname);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user