mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-31 05:57:01 +00:00
Merge branch 'master' of https://github.com/gnh1201/welsonjs
This commit is contained in:
commit
109df0424b
10
app.js
10
app.js
|
@ -95,15 +95,17 @@ function require(FN) {
|
|||
|
||||
// get directory name
|
||||
var getDirName = function(path) {
|
||||
var pos = path.lastIndexOf("\\");
|
||||
return path.substring(0, pos);
|
||||
var delimiter = "\\";
|
||||
var pos = path.lastIndexOf(delimiter);
|
||||
return (pos > -1 ? path.substring(0, pos) : "");
|
||||
};
|
||||
|
||||
// get current script directory
|
||||
var getCurrentScriptDirectory = function() {
|
||||
if (typeof(WScript) !== "undefined") {
|
||||
var path = WScript.ScriptFullName;
|
||||
return getDirName(path);
|
||||
return getDirName(WScript.ScriptFullName);
|
||||
} else if (typeof(document) !== "undefined") {
|
||||
return getDirName(document.location.pathname);
|
||||
} else {
|
||||
return ".";
|
||||
}
|
||||
|
|
2
bootstrap.js
vendored
2
bootstrap.js
vendored
|
@ -24,7 +24,7 @@ exports.main = function(args) {
|
|||
REG.write(REG.HKCR, __config.appName, "", "URL:" + __config.appName, REG.STRING);
|
||||
REG.write(REG.HKCR, __config.appName, "URL Protocol", "", REG.STRING);
|
||||
REG.write(REG.HKCR, __config.appName + "\\DefaultIcon", "", SYS.getCurrentScriptDirectory() + "\\app\\favicon.ico,0", REG.STRING);
|
||||
REG.write(REG.HKCR, __config.appName + "\\shell\\open\\command", "", "cscript " + SYS.getCurrentScriptDirectory() + "\\app.js uriloader \"%1\"", REG.STRING);
|
||||
REG.write(REG.HKCR, __config.appName + "\\shell\\open\\command", "", "cmd.exe /c cscript " + SYS.getCurrentScriptDirectory() + "\\app.js uriloader \"%1\"", REG.STRING);
|
||||
|
||||
// open HTA file
|
||||
console.log("Trying open GUI...");
|
||||
|
|
|
@ -99,21 +99,33 @@ exports.getCurrentWorkingDirectory = function() {
|
|||
} 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() {
|
||||
if(typeof(WScript) !== "undefined") {
|
||||
var path = WScript.ScriptFullName;
|
||||
var pos = path.lastIndexOf("\\");
|
||||
return path.substring(0, pos);
|
||||
if (typeof(WScript) !== "undefined") {
|
||||
return exports.getDirName(WScript.ScriptFullName);
|
||||
} else if (typeof(document) !== "undefined") {
|
||||
return exports.getDirName(document.location.pathname);
|
||||
} else {
|
||||
return ".";
|
||||
}
|
||||
};
|
||||
|
||||
// "console only";
|
||||
exports.getCurrentScriptName = function() {
|
||||
if(typeof(WScript) !== "undefined") {
|
||||
return WScript.ScriptName;
|
||||
} else if (typeof(document) !== "undefined") {
|
||||
return exports.getFileName(document.location.pathname);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user