mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 04:31: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 (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
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var T = null;
|
||||
try {
|
||||
var TS = FSO.OpenTextFile(FN, 1);
|
||||
TS = FSO.OpenTextFile(getCurrentScriptDirectory() + "\\" + FN, 1);
|
||||
if (TS.AtEndOfStream) return "";
|
||||
T = TS.ReadAll();
|
||||
TS.Close();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Shell API
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var FILE = require('lib/file');
|
||||
var FILE = require("lib/file");
|
||||
|
||||
exports.VERSIONINFO = "Shell Module (shell.js) version 0.1";
|
||||
exports.global = global;
|
||||
|
|
|
@ -101,9 +101,13 @@ exports.getCurrentWorkingDirectory = function() {
|
|||
|
||||
// "console only";
|
||||
exports.getCurrentScriptDirectory = function() {
|
||||
var path = WScript.ScriptFullName;
|
||||
var pos = path.lastIndexOf("\\");
|
||||
return path.substring(0, pos);
|
||||
if(typeof(WScript) !== "undefined") {
|
||||
var path = WScript.ScriptFullName;
|
||||
var pos = path.lastIndexOf("\\");
|
||||
return path.substring(0, pos);
|
||||
} else {
|
||||
return ".";
|
||||
}
|
||||
};
|
||||
|
||||
exports.getNetworkInterfaces = function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user