1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-01 16:05:45 +01:00

fixed io.run() for windows.

This commit is contained in:
Martin Stubenschrott
2008-05-26 09:25:27 +00:00
parent e7d8cce787
commit bf239c2db2

View File

@@ -461,6 +461,7 @@ liberator.IO = function () //{{{
catch (e) catch (e)
{ {
var dirs = environmentService.get("PATH").split(WINDOWS ? ";" : ":"); var dirs = environmentService.get("PATH").split(WINDOWS ? ";" : ":");
lookup:
for (var i = 0; i < dirs.length; i++) for (var i = 0; i < dirs.length; i++)
{ {
var path = dirs[i] + (WINDOWS ? "\\" : "/") + program; var path = dirs[i] + (WINDOWS ? "\\" : "/") + program;
@@ -470,16 +471,16 @@ liberator.IO = function () //{{{
if (file.exists()) if (file.exists())
break; break;
// automatically try to add common file extensions on windows // automatically try to add the executable path extensions on windows
if (WINDOWS) if (WINDOWS)
{ {
var extensions = [".exe", ".cmd", ".bat"]; var extensions = environmentService.get("PATHEXT").split(";");
for (let j = 0; j < extensions.length; j++) for (let j = 0; j < extensions.length; j++)
{ {
path = dirs[i] + "\\" + program + extensions[j]; path = dirs[i] + "\\" + program + extensions[j];
file.initWithPath(path); file.initWithPath(path);
if (file.exists()) if (file.exists())
break; break lookup;
} }
} }
} }