mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 22:22:27 +01:00
Somewhat more resilient File.expandPath and File#init. Fixes Pentadactyl on wine.
This commit is contained in:
@@ -912,9 +912,9 @@ const Commands = Module("commands", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dynamically get completions as specified with the command's completer function
|
// dynamically get completions as specified with the command's completer function
|
||||||
|
context.highlight();
|
||||||
let command = cmd && commands.get(cmd);
|
let command = cmd && commands.get(cmd);
|
||||||
if (!command) {
|
if (!command) {
|
||||||
context.highlight();
|
|
||||||
context.highlight(0, cmd && cmd.length, "SPELLCHECK");
|
context.highlight(0, cmd && cmd.length, "SPELLCHECK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,12 +264,13 @@ const Storage = Module("Storage", {
|
|||||||
}, {
|
}, {
|
||||||
}, {
|
}, {
|
||||||
init: function (dactyl, modules) {
|
init: function (dactyl, modules) {
|
||||||
let infoPath = services.create("file");
|
let infoPath = File(modules.IO.runtimePath.replace(/,.*/, ""));
|
||||||
infoPath.initWithPath(File.expandPath(modules.IO.runtimePath.replace(/,.*/, "")));
|
if (infoPath) {
|
||||||
infoPath.append("info");
|
infoPath.append("info");
|
||||||
infoPath.append(dactyl.profileName);
|
infoPath.append(dactyl.profileName);
|
||||||
storage.infoPath = infoPath;
|
storage.infoPath = infoPath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -289,6 +290,7 @@ const File = Class("File", {
|
|||||||
else if (/file:\/\//.test(path))
|
else if (/file:\/\//.test(path))
|
||||||
file = services.create("file:").getFileFromURLSpec(path);
|
file = services.create("file:").getFileFromURLSpec(path);
|
||||||
else {
|
else {
|
||||||
|
try {
|
||||||
let expandedPath = File.expandPath(path);
|
let expandedPath = File.expandPath(path);
|
||||||
|
|
||||||
if (!File.isAbsolutePath(expandedPath) && checkPWD)
|
if (!File.isAbsolutePath(expandedPath) && checkPWD)
|
||||||
@@ -296,6 +298,11 @@ const File = Class("File", {
|
|||||||
else
|
else
|
||||||
file.initWithPath(expandedPath);
|
file.initWithPath(expandedPath);
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
dump("dactyl: " + e + "\n" + String.replace(e.stack, /^/gm, "dactyl: ") + "\n");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
let self = XPCSafeJSObjectWrapper(file);
|
let self = XPCSafeJSObjectWrapper(file);
|
||||||
self.__proto__ = File.prototype;
|
self.__proto__ = File.prototype;
|
||||||
return self;
|
return self;
|
||||||
@@ -510,7 +517,7 @@ const File = Class("File", {
|
|||||||
let home = services.get("environment").get("HOME");
|
let home = services.get("environment").get("HOME");
|
||||||
|
|
||||||
// Windows has its own idiosyncratic $HOME variables.
|
// Windows has its own idiosyncratic $HOME variables.
|
||||||
if (!home && win32)
|
if (win32 && (!home || !File(home) || !File(home).exists()))
|
||||||
home = services.get("environment").get("USERPROFILE") ||
|
home = services.get("environment").get("USERPROFILE") ||
|
||||||
services.get("environment").get("HOMEDRIVE") + services.get("environment").get("HOMEPATH");
|
services.get("environment").get("HOMEDRIVE") + services.get("environment").get("HOMEPATH");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user