Update uriloader.js

This commit is contained in:
Namhyeon Go 2020-11-04 17:38:04 +09:00
parent 793d8d84ac
commit f133bbe04a

View File

@ -14,85 +14,103 @@ exports.main = function(args) {
if (pos < 0) { if (pos < 0) {
console.log("Not vaild URI scheme"); console.log("Not vaild URI scheme");
} else { } else {
var cmd = [], var commands = [],
queryString = uri.substring(pos + 4), queryString = uri.substring(pos + 4),
query = URI.parseQueryString(queryString); query = URI.parseQueryString(queryString);
if (!query.application) { if (!query.application)
query.application = ""; query.application = "";
}
switch (query.application) { switch (query.application) {
case "app": case "app":
cmd.push("start"); commands.push([
cmd.push("/d"); "start",
cmd.push(SYS.getCurrentScriptDirectory()); "/d",
cmd.push("app.hta"); SYS.getCurrentScriptDirectory(),
cmd.push(uri); // passing URI to application "app.hta",
uri
]);
break; break;
case "mscalc": case "mscalc":
cmd.push("calc.exe"); commands.push([
"calc.exe"
]);
break; break;
case "msie": case "msie":
//cmd.push("%PROGRAMFILES%\\Internet Explorer\\iexplore.exe");
//cmd.push("https://github.com/gnh1201/welsonjs");
WINLIBS.loadLibrary("url").call("FileProtocolHandler", [ WINLIBS.loadLibrary("url").call("FileProtocolHandler", [
"https://github.com/gnh1201/welsonjs" "https://github.com/gnh1201/welsonjs"
]); ]);
break; break;
case "msexcel": case "msexcel":
cmd.push("%PROGRAMFILES%\\Microsoft Office\\Office15\\EXCEL.EXE"); commands.push([
"%PROGRAMFILES%\\Microsoft Office\\Office15\\EXCEL.EXE"
]);
break; break;
case "mspowerpoint": case "mspowerpoint":
cmd.push("%PROGRAMFILES%\\Microsoft Office\\Office15\\POWERPNT.EXE"); commands.push([
"%PROGRAMFILES%\\Microsoft Office\\Office15\\POWERPNT.EXE"
]);
break; break;
case "msword": case "msword":
cmd.push("%PROGRAMFILES%\\Microsoft Office\\Office15\\WINWORD.EXE"); commands.push([
"%PROGRAMFILES%\\Microsoft Office\\Office15\\WINWORD.EXE"
]);
break; break;
case "msaccess": case "msaccess":
cmd.push("%PROGRAMFILES%\\Microsoft Office\\Office15\\MSACCESS.EXE"); commands.push([
"%PROGRAMFILES%\\Microsoft Office\\Office15\\MSACCESS.EXE"
]);
break; break;
case "ldmultiplayer": case "ldmultiplayer":
cmd.push("%SYSTEMDRIVE%\\LDPlayer\LDPlayer3.0\\dnmultiplayer.exe"); commands.push([
"%SYSTEMDRIVE%\\LDPlayer\LDPlayer3.0\\dnmultiplayer.exe"
]);
break; break;
case "noxmultiplayer": case "noxmultiplayer":
cmd.push("%PROGRAMFILES(X86)%\\Nox\\bin\\MultiPlayerManager.exe"); commands.push([
"%PROGRAMFILES(X86)%\\Nox\\bin\\MultiPlayerManager.exe"
]);
break; break;
case "codingschool": case "codingschool":
cmd.push("%PROGRAMFILES(X86)\\CodingSchool3\\CodingSchool3.exe"); commands.push([
//cmd.push(SYS.getCurrentScriptDirectory() + "\\bin\\CodingSchool\\CodingSchool.exe"); "%PROGRAMFILES(X86)\\CodingSchool3\\CodingSchool3.exe"
]);
break; break;
case "arduino": case "arduino":
cmd.push("%PROGRAMFILES(X86)%\\Arduino\\arduino.exe"); commands.push([
"%PROGRAMFILES(X86)%\\Arduino\\arduino.exe"
]);
break; break;
case "opentyping": case "opentyping":
cmd.push(SYS.getCurrentScriptDirectory() + "\\bin\\OpenTyping\\OpenTyping.exe"); commands.push([
SYS.getCurrentScriptDirectory() + "\\bin\\OpenTyping\\OpenTyping.exe"
]);
break; break;
case "hnctt80": case "hnctt80":
cmd.push("%PROGRAMFILES(X86)%\\HNC\\HncTT80\\HncTT.exe"); commands.push([
"%PROGRAMFILES(X86)%\\HNC\\HncTT80\\HncTT.exe"
]);
break; break;
dafault: dafault:
console.log("Unknown application"); console.log("Unknown application");
} }
if (typeof(query.args) !== "undefined") { if (commands.length > 0) {
cmd.push(query.args); SHELL.run(commands.pop());
} }
SHELL.run(cmd);
} }
return 0; return 0;