1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 19:27:58 +01:00

make vimperator.run() Windows aware...poor thing

This commit is contained in:
Doug Kearns
2007-10-06 07:07:06 +00:00
parent 4dbe0b3643
commit 505cc2d0ed

View File

@@ -543,25 +543,27 @@ const vimperator = (function() //{{{
run: function(program, args, blocking)
{
const WINDOWS = navigator.platform == "Win32";
var file = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
try {
try
{
file.initWithPath(program);
}
catch (e)
{
//environment_service
// FIXME: doesn't work on windows
var dirs = environment_service.get("PATH").split(":");
var dirs = environment_service.get("PATH").split(WINDOWS ? ";" : ":");
for (var i = 0; i < dirs.length; i++)
{
var path = dirs[i] + "/" + program;
var path = dirs[i] + (WINDOWS ? "\\" : "/") + program;
try
{
file.initWithPath(path);
if (file.exists())
break;
} catch (e) { }
}
catch (e) { }
}
}
if (!file.exists())
@@ -577,6 +579,7 @@ const vimperator = (function() //{{{
var ec = process.run(blocking, args, args.length);
return ec;
},
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
// is fixed, should use that instead of a tmpfile
// TODO: make it usable on windows