mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 19:07:58 +01:00
make vimperator.run() Windows aware...poor thing
This commit is contained in:
@@ -543,25 +543,27 @@ const vimperator = (function() //{{{
|
|||||||
|
|
||||||
run: function(program, args, blocking)
|
run: function(program, args, blocking)
|
||||||
{
|
{
|
||||||
|
const WINDOWS = navigator.platform == "Win32";
|
||||||
|
|
||||||
var file = Components.classes["@mozilla.org/file/local;1"].
|
var file = Components.classes["@mozilla.org/file/local;1"].
|
||||||
createInstance(Components.interfaces.nsILocalFile);
|
createInstance(Components.interfaces.nsILocalFile);
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
file.initWithPath(program);
|
file.initWithPath(program);
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
//environment_service
|
var dirs = environment_service.get("PATH").split(WINDOWS ? ";" : ":");
|
||||||
// FIXME: doesn't work on windows
|
|
||||||
var dirs = environment_service.get("PATH").split(":");
|
|
||||||
for (var i = 0; i < dirs.length; i++)
|
for (var i = 0; i < dirs.length; i++)
|
||||||
{
|
{
|
||||||
var path = dirs[i] + "/" + program;
|
var path = dirs[i] + (WINDOWS ? "\\" : "/") + program;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
file.initWithPath(path);
|
file.initWithPath(path);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
break;
|
break;
|
||||||
} catch (e) { }
|
}
|
||||||
|
catch (e) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
@@ -577,6 +579,7 @@ const vimperator = (function() //{{{
|
|||||||
var ec = process.run(blocking, args, args.length);
|
var ec = process.run(blocking, args, args.length);
|
||||||
return ec;
|
return ec;
|
||||||
},
|
},
|
||||||
|
|
||||||
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
|
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
|
||||||
// is fixed, should use that instead of a tmpfile
|
// is fixed, should use that instead of a tmpfile
|
||||||
// TODO: make it usable on windows
|
// TODO: make it usable on windows
|
||||||
|
|||||||
Reference in New Issue
Block a user