mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 20:52:26 +01:00
return a file object from io.getCurrentDirectory
This commit is contained in:
@@ -551,7 +551,7 @@ function Buffer() //{{{
|
||||
// if browser.download.useDownloadDir = false then the "Save As"
|
||||
// dialog is used with this as the default directory
|
||||
// TODO: if we're going to do this shouldn't it be done in setCWD or the value restored?
|
||||
options.setPref("browser.download.lastDir", io.getCurrentDirectory());
|
||||
options.setPref("browser.download.lastDir", io.getCurrentDirectory().path);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1110,7 +1110,7 @@ function Buffer() //{{{
|
||||
{
|
||||
urlSecurityCheck(url, doc.nodePrincipal);
|
||||
// we always want to save that link relative to the current working directory
|
||||
options.setPref("browser.download.lastDir", io.getCurrentDirectory());
|
||||
options.setPref("browser.download.lastDir", io.getCurrentDirectory().path);
|
||||
saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet));
|
||||
}
|
||||
catch (e)
|
||||
|
||||
@@ -45,7 +45,7 @@ function IO() //{{{
|
||||
.createInstance(Components.interfaces.nsIDownloadManager);
|
||||
|
||||
var processDir = directoryService.get("CurWorkD", Components.interfaces.nsIFile);
|
||||
var cwd = processDir.path;
|
||||
var cwd = processDir;
|
||||
var oldcwd = null;
|
||||
|
||||
var lastRunCommand = ""; // updated whenever the users runs a command with :!
|
||||
@@ -149,7 +149,7 @@ function IO() //{{{
|
||||
{
|
||||
if (oldcwd)
|
||||
{
|
||||
args = oldcwd;
|
||||
args = oldcwd.path;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,7 +166,7 @@ function IO() //{{{
|
||||
{
|
||||
// TODO: apparently we don't handle ../ or ./ paths yet
|
||||
if (io.setCurrentDirectory(args))
|
||||
liberator.echo(io.getCurrentDirectory());
|
||||
liberator.echo(io.getCurrentDirectory().path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -174,7 +174,7 @@ function IO() //{{{
|
||||
|
||||
// empty 'cdpath' items mean the current directory
|
||||
directories = directories.map(
|
||||
function (directory) directory == "" ? io.getCurrentDirectory() : directory
|
||||
function (directory) directory == "" ? io.getCurrentDirectory().path : directory
|
||||
);
|
||||
|
||||
var directoryFound = false;
|
||||
@@ -186,7 +186,7 @@ function IO() //{{{
|
||||
{
|
||||
// FIXME: we're just overwriting the error message from
|
||||
// setCurrentDirectory here
|
||||
liberator.echo(io.getCurrentDirectory());
|
||||
liberator.echo(io.getCurrentDirectory().path);
|
||||
directoryFound = true;
|
||||
break;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ function IO() //{{{
|
||||
|
||||
commands.add(["pw[d]"],
|
||||
"Print the current directory name",
|
||||
function () { liberator.echo(io.getCurrentDirectory()); },
|
||||
function () { liberator.echo(io.getCurrentDirectory().path); },
|
||||
{ argCount: "0" });
|
||||
|
||||
// "mkv[imperatorrc]" or "mkm[uttatorrc]"
|
||||
@@ -426,14 +426,14 @@ function IO() //{{{
|
||||
// Firefox's CWD - see // https://bugzilla.mozilla.org/show_bug.cgi?id=280953
|
||||
getCurrentDirectory: function ()
|
||||
{
|
||||
let dir = ioManager.getFile(cwd);
|
||||
let dir = ioManager.getFile(cwd.path);
|
||||
|
||||
// NOTE: the directory could have been deleted underneath us so
|
||||
// fallback to Firefox's CWD
|
||||
if (dir.exists() && dir.isDirectory())
|
||||
return dir.path;
|
||||
return dir;
|
||||
else
|
||||
return processDir.path;
|
||||
return processDir;
|
||||
},
|
||||
|
||||
setCurrentDirectory: function (newdir)
|
||||
@@ -454,7 +454,7 @@ function IO() //{{{
|
||||
return null;
|
||||
}
|
||||
|
||||
[cwd, oldcwd] = [dir.path, this.getCurrentDirectory()];
|
||||
[cwd, oldcwd] = [dir, this.getCurrentDirectory()];
|
||||
}
|
||||
|
||||
return ioManager.getCurrentDirectory();
|
||||
@@ -507,7 +507,7 @@ function IO() //{{{
|
||||
let expandedPath = ioManager.expandPath(path);
|
||||
|
||||
if (!/^([a-zA-Z]:|\/)/.test(expandedPath)) // doesn't start with /, C:
|
||||
expandedPath = joinPaths(ioManager.getCurrentDirectory(), expandedPath);
|
||||
expandedPath = joinPaths(ioManager.getCurrentDirectory().path, expandedPath);
|
||||
|
||||
file.initWithPath(expandedPath);
|
||||
}
|
||||
@@ -711,10 +711,10 @@ lookup:
|
||||
return "";
|
||||
|
||||
if (WINDOWS)
|
||||
command = "cd /D " + cwd + " && " + command + " > " + stdoutFile.path + " 2> " + stderrFile.path;
|
||||
command = "cd /D " + cwd.path + " && " + command + " > " + stdoutFile.path + " 2> " + stderrFile.path;
|
||||
else
|
||||
// TODO: should we only attempt the actual command conditionally on a successful cd?
|
||||
command = "cd " + escapeQuotes(cwd) + "; " + command + " > \"" + escapeQuotes(stdoutFile.path) + "\""
|
||||
command = "cd " + escapeQuotes(cwd.path) + "; " + command + " > \"" + escapeQuotes(stdoutFile.path) + "\""
|
||||
+ " 2> \"" + escapeQuotes(stderrFile.path) + "\"";
|
||||
|
||||
var stdinFile = null;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ const liberator = (function () //{{{
|
||||
|
||||
if (options["exrc"])
|
||||
{
|
||||
let localRcFile = io.getRCFile(io.getCurrentDirectory());
|
||||
let localRcFile = io.getRCFile(io.getCurrentDirectory().path);
|
||||
if (localRcFile)
|
||||
io.source(localRcFile.path, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user