mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-14 23:33:38 +01:00
Allow relative paths for 'shell'.
This commit is contained in:
4
common/bootstrap.js
vendored
4
common/bootstrap.js
vendored
@@ -52,10 +52,6 @@ function startup(data, reason) {
|
|||||||
addon = data;
|
addon = data;
|
||||||
AddonManager.getAddonByID(addon.id, function (a) { addon = a; });
|
AddonManager.getAddonByID(addon.id, function (a) { addon = a; });
|
||||||
|
|
||||||
// Temporary hack.
|
|
||||||
if (basePath.isDirectory() && global.JSMLoader && JSMLoader.bump == null)
|
|
||||||
JSMLoader.bump = 2;
|
|
||||||
|
|
||||||
if (basePath.isDirectory())
|
if (basePath.isDirectory())
|
||||||
getURI = function getURI(path) {
|
getURI = function getURI(path) {
|
||||||
let file = basePath.clone().QueryInterface(Ci.nsILocalFile);
|
let file = basePath.clone().QueryInterface(Ci.nsILocalFile);
|
||||||
|
|||||||
@@ -673,11 +673,13 @@ var Options = Module("options", {
|
|||||||
memoize(this._optionMap, name, function () Option(names, description, type, defaultValue, extraInfo));
|
memoize(this._optionMap, name, function () Option(names, description, type, defaultValue, extraInfo));
|
||||||
for (let alias in values(names.slice(1)))
|
for (let alias in values(names.slice(1)))
|
||||||
memoize(this._optionMap, alias, closure);
|
memoize(this._optionMap, alias, closure);
|
||||||
|
|
||||||
if (extraInfo.setter && (!extraInfo.scope || extraInfo.scope & Option.SCOPE_GLOBAL))
|
if (extraInfo.setter && (!extraInfo.scope || extraInfo.scope & Option.SCOPE_GLOBAL))
|
||||||
if (dactyl.initialized)
|
if (dactyl.initialized)
|
||||||
closure().initValue();
|
closure().initValue();
|
||||||
else
|
else
|
||||||
memoize(this.needInit, this.needInit.length, closure);
|
memoize(this.needInit, this.needInit.length, closure);
|
||||||
|
|
||||||
this._floptions = (this._floptions || []).concat(name);
|
this._floptions = (this._floptions || []).concat(name);
|
||||||
memoize(this._options, this._options.length, closure);
|
memoize(this._options, this._options.length, closure);
|
||||||
|
|
||||||
|
|||||||
@@ -332,6 +332,9 @@ var IO = Module("io", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
pathSearch: function (bin) {
|
pathSearch: function (bin) {
|
||||||
|
if (bin instanceof File || File.isAbsolutePath(bin))
|
||||||
|
return this.File(bin);
|
||||||
|
|
||||||
let dirs = services.environment.get("PATH").split(util.OS.isWindows ? ";" : ":");
|
let dirs = services.environment.get("PATH").split(util.OS.isWindows ? ";" : ":");
|
||||||
// Windows tries the CWD first TODO: desirable?
|
// Windows tries the CWD first TODO: desirable?
|
||||||
if (util.OS.isWindows)
|
if (util.OS.isWindows)
|
||||||
@@ -368,12 +371,7 @@ var IO = Module("io", {
|
|||||||
run: function (program, args, blocking) {
|
run: function (program, args, blocking) {
|
||||||
args = args || [];
|
args = args || [];
|
||||||
|
|
||||||
let file;
|
let file = this.pathSearch(program);
|
||||||
|
|
||||||
if (program instanceof File || File.isAbsolutePath(program))
|
|
||||||
file = this.File(program, true);
|
|
||||||
else
|
|
||||||
file = this.pathSearch(program);
|
|
||||||
|
|
||||||
if (!file || !file.exists()) {
|
if (!file || !file.exists()) {
|
||||||
util.dactyl.echoerr("Command not found: " + program);
|
util.dactyl.echoerr("Command not found: " + program);
|
||||||
@@ -425,8 +423,9 @@ var IO = Module("io", {
|
|||||||
else if (input)
|
else if (input)
|
||||||
stdin.write(input);
|
stdin.write(input);
|
||||||
|
|
||||||
let shell = File(storage["options"].get("shell").value);
|
let shell = io.pathSearch(storage["options"].get("shell").value);
|
||||||
let shcf = storage["options"].get("shellcmdflag").value;
|
let shcf = storage["options"].get("shellcmdflag").value;
|
||||||
|
util.assert(shell, "Invalid 'shell'");
|
||||||
|
|
||||||
if (isArray(command))
|
if (isArray(command))
|
||||||
command = command.map(escape).join(" ");
|
command = command.map(escape).join(" ");
|
||||||
@@ -1009,7 +1008,8 @@ unlet s:cpo_save
|
|||||||
|
|
||||||
options.add(["shell", "sh"],
|
options.add(["shell", "sh"],
|
||||||
"Shell to use for executing external commands with :! and :run",
|
"Shell to use for executing external commands with :! and :run",
|
||||||
"string", shell);
|
"string", shell,
|
||||||
|
{ validator: function (val) io.pathSearch(val) });
|
||||||
|
|
||||||
options.add(["shellcmdflag", "shcf"],
|
options.add(["shellcmdflag", "shcf"],
|
||||||
"Flag passed to shell when executing external commands with :! and :run",
|
"Flag passed to shell when executing external commands with :! and :run",
|
||||||
|
|||||||
Reference in New Issue
Block a user