1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 19:27:58 +01:00

remove io.pathExists()

This commit is contained in:
Doug Kearns
2007-10-20 02:53:46 +00:00
parent 0c505415a0
commit 9873fed42c
3 changed files with 9 additions and 19 deletions

2
NEWS
View File

@@ -3,7 +3,7 @@
* version 0.6
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
* you can edit textfields with Ctrl-i now using an external editor (thanks to Joseph Xu)
* :open,:bmarks,etc. filter on space seperated tokens now, so you can
* :open, :bmarks, etc. filter on space separated tokens now, so you can
search with :open linux windows <tab> all your bookmarks/history
which contain linux AND windows in the url or title
* tags and keyword support for :bmark

View File

@@ -86,16 +86,6 @@ vimperator.io = (function()
return path;
},
// path can also be a filename, not limited to directories
pathExists: function(path)
{
var p = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
p.initWithPath(this.expandPath(path));
return p.exists();
},
getPluginDir: function()
{
var plugin_dir;
@@ -105,22 +95,22 @@ vimperator.io = (function()
else
plugin_dir = "~/.vimperator/plugin";
plugin_dir = this.expandPath(plugin_dir);
plugin_dir = this.getFile(this.expandPath(plugin_dir));
return this.pathExists(plugin_dir) ? plugin_dir : null;
return plugin_dir.exists() && plugin_dir.isDirectory() ? plugin_dir : null;
},
getRCFile: function()
{
var rc_file1 = this.expandPath("~/.vimperatorrc");
var rc_file2 = this.expandPath("~/_vimperatorrc");
var rc_file1 = this.getFile(this.expandPath("~/.vimperatorrc"));
var rc_file2 = this.getFile(this.expandPath("~/_vimperatorrc"));
if (navigator.platform == "Win32")
[rc_file1, rc_file2] = [rc_file2, rc_file1]
if (this.pathExists(rc_file1))
if (rc_file1.exists() && rc_file1.isFile())
return rc_file1;
else if (this.pathExists(rc_file2))
else if (rc_file2.exists() && rc_file2.isFile())
return rc_file2;
else
return null;

View File

@@ -636,7 +636,7 @@ const vimperator = (function() //{{{
var rc_file = vimperator.io.getRCFile();
if (rc_file)
vimperator.source(rc_file, true);
vimperator.source(rc_file.path, true);
else
vimperator.log("No user RC file found", 3);
@@ -648,7 +648,7 @@ const vimperator = (function() //{{{
if (plugin_dir)
{
var files = vimperator.io.readDirectory(plugin_dir);
var files = vimperator.io.readDirectory(plugin_dir.path);
vimperator.log("Sourcing plugin directory...", 3);
files.forEach(function(file) {
if (!file.isDirectory())