1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 18:12:26 +01:00

Fix Windows platform detection.

--HG--
extra : rebase_source : 22fa7cb45e3571c2fd4fe527121c50ceac249b25
This commit is contained in:
Doug Kearns
2010-09-22 17:36:04 +10:00
parent 60eac8d752
commit 542086159f
7 changed files with 20 additions and 24 deletions

View File

@@ -182,7 +182,7 @@ const IO = Module("io", {
let rcFile1 = File.joinPaths(dir, "." + config.name + "rc");
let rcFile2 = File.joinPaths(dir, "_" + config.name + "rc");
if (dactyl.has("Win32"))
if (dactyl.has("WINNT"))
[rcFile1, rcFile2] = [rcFile2, rcFile1];
if (rcFile1.exists() && rcFile1.isFile())
@@ -226,9 +226,9 @@ const IO = Module("io", {
if (File.isAbsolutePath(program))
file = io.File(program, true);
else {
let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":");
let dirs = services.get("environment").get("PATH").split(dactyl.has("WINNT") ? ";" : ":");
// Windows tries the CWD first TODO: desirable?
if (dactyl.has("Win32"))
if (dactyl.has("WINNT"))
dirs = [io.getCurrentDirectory().path].concat(dirs);
lookup:
@@ -240,7 +240,7 @@ lookup:
// TODO: couldn't we just palm this off to the start command?
// automatically try to add the executable path extensions on windows
if (dactyl.has("Win32")) {
if (dactyl.has("WINNT")) {
let extensions = services.get("environment").get("PATHEXT").split(";");
for (let [, extension] in Iterator(extensions)) {
file = File.joinPaths(dir, program + extension);
@@ -459,7 +459,7 @@ lookup:
stdin.write(input);
// TODO: implement 'shellredir'
if (dactyl.has("Win32")) {
if (dactyl.has("WINNT")) {
command = "cd /D " + this._cwd.path + " && " + command + " > " + stdout.path + " 2>&1" + " < " + stdin.path;
var res = this.run(options["shell"], options["shellcmdflag"].split(/\s+/).concat(command), true);
}
@@ -513,7 +513,7 @@ lookup:
const rtpvar = config.idname + "_RUNTIME";
let rtp = services.get("environment").get(rtpvar);
if (!rtp) {
rtp = "~/" + (dactyl.has("Win32") ? "" : ".") + config.name;
rtp = "~/" + (dactyl.has("WINNT") ? "" : ".") + config.name;
services.get("environment").set(rtpvar, rtp);
}
return rtp;
@@ -703,7 +703,7 @@ lookup:
};
completion.environment = function environment(context) {
let command = dactyl.has("Win32") ? "set" : "env";
let command = dactyl.has("WINNT") ? "set" : "env";
let lines = io.system(command).split("\n");
lines.pop();
@@ -750,7 +750,7 @@ lookup:
completion.shellCommand = function shellCommand(context) {
context.title = ["Shell Command", "Path"];
context.generate = function () {
let dirNames = services.get("environment").get("PATH").split(RegExp(dactyl.has("Win32") ? ";" : ":"));
let dirNames = services.get("environment").get("PATH").split(RegExp(dactyl.has("WINNT") ? ";" : ":"));
let commands = [];
for (let [, dirName] in Iterator(dirNames)) {
@@ -780,7 +780,7 @@ lookup:
},
options: function () {
var shell, shellcmdflag;
if (dactyl.has("Win32")) {
if (dactyl.has("WINNT")) {
shell = "cmd.exe";
// TODO: setting 'shell' to "something containing sh" updates
// 'shellcmdflag' appropriately at startup on Windows in Vim