mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-17 15:11:04 +00:00
fix
This commit is contained in:
parent
321a83fa72
commit
ef04c7ce0c
13
app.js
13
app.js
|
@ -74,11 +74,22 @@ function require(FN) {
|
||||||
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
||||||
if (cache[FN]) return cache[FN];
|
if (cache[FN]) return cache[FN];
|
||||||
|
|
||||||
|
// get current script directory
|
||||||
|
var getCurrentScriptDirectory = function() {
|
||||||
|
if(typeof(WScript) !== "undefined") {
|
||||||
|
var path = WScript.ScriptFullName;
|
||||||
|
var pos = path.lastIndexOf("\\");
|
||||||
|
return path.substring(0, pos);
|
||||||
|
} else {
|
||||||
|
return ".";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// load script file
|
// load script file
|
||||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||||
var T = null;
|
var T = null;
|
||||||
try {
|
try {
|
||||||
var TS = FSO.OpenTextFile(FN, 1);
|
TS = FSO.OpenTextFile(getCurrentScriptDirectory() + "\\" + FN, 1);
|
||||||
if (TS.AtEndOfStream) return "";
|
if (TS.AtEndOfStream) return "";
|
||||||
T = TS.ReadAll();
|
T = TS.ReadAll();
|
||||||
TS.Close();
|
TS.Close();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Shell API
|
// Shell API
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var FILE = require('lib/file');
|
var FILE = require("lib/file");
|
||||||
|
|
||||||
exports.VERSIONINFO = "Shell Module (shell.js) version 0.1";
|
exports.VERSIONINFO = "Shell Module (shell.js) version 0.1";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
|
|
|
@ -101,9 +101,13 @@ exports.getCurrentWorkingDirectory = function() {
|
||||||
|
|
||||||
// "console only";
|
// "console only";
|
||||||
exports.getCurrentScriptDirectory = function() {
|
exports.getCurrentScriptDirectory = function() {
|
||||||
|
if(typeof(WScript) !== "undefined") {
|
||||||
var path = WScript.ScriptFullName;
|
var path = WScript.ScriptFullName;
|
||||||
var pos = path.lastIndexOf("\\");
|
var pos = path.lastIndexOf("\\");
|
||||||
return path.substring(0, pos);
|
return path.substring(0, pos);
|
||||||
|
} else {
|
||||||
|
return ".";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getNetworkInterfaces = function() {
|
exports.getNetworkInterfaces = function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user