mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 19:07:58 +01:00
remove io.pathExists()
This commit is contained in:
2
NEWS
2
NEWS
@@ -3,7 +3,7 @@
|
|||||||
* version 0.6
|
* version 0.6
|
||||||
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
||||||
* you can edit textfields with Ctrl-i now using an external editor (thanks to Joseph Xu)
|
* 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
|
search with :open linux windows <tab> all your bookmarks/history
|
||||||
which contain linux AND windows in the url or title
|
which contain linux AND windows in the url or title
|
||||||
* tags and keyword support for :bmark
|
* tags and keyword support for :bmark
|
||||||
|
|||||||
@@ -86,16 +86,6 @@ vimperator.io = (function()
|
|||||||
return path;
|
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()
|
getPluginDir: function()
|
||||||
{
|
{
|
||||||
var plugin_dir;
|
var plugin_dir;
|
||||||
@@ -105,22 +95,22 @@ vimperator.io = (function()
|
|||||||
else
|
else
|
||||||
plugin_dir = "~/.vimperator/plugin";
|
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()
|
getRCFile: function()
|
||||||
{
|
{
|
||||||
var rc_file1 = this.expandPath("~/.vimperatorrc");
|
var rc_file1 = this.getFile(this.expandPath("~/.vimperatorrc"));
|
||||||
var rc_file2 = this.expandPath("~/_vimperatorrc");
|
var rc_file2 = this.getFile(this.expandPath("~/_vimperatorrc"));
|
||||||
|
|
||||||
if (navigator.platform == "Win32")
|
if (navigator.platform == "Win32")
|
||||||
[rc_file1, rc_file2] = [rc_file2, rc_file1]
|
[rc_file1, rc_file2] = [rc_file2, rc_file1]
|
||||||
|
|
||||||
if (this.pathExists(rc_file1))
|
if (rc_file1.exists() && rc_file1.isFile())
|
||||||
return rc_file1;
|
return rc_file1;
|
||||||
else if (this.pathExists(rc_file2))
|
else if (rc_file2.exists() && rc_file2.isFile())
|
||||||
return rc_file2;
|
return rc_file2;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ const vimperator = (function() //{{{
|
|||||||
var rc_file = vimperator.io.getRCFile();
|
var rc_file = vimperator.io.getRCFile();
|
||||||
|
|
||||||
if (rc_file)
|
if (rc_file)
|
||||||
vimperator.source(rc_file, true);
|
vimperator.source(rc_file.path, true);
|
||||||
else
|
else
|
||||||
vimperator.log("No user RC file found", 3);
|
vimperator.log("No user RC file found", 3);
|
||||||
|
|
||||||
@@ -648,7 +648,7 @@ const vimperator = (function() //{{{
|
|||||||
|
|
||||||
if (plugin_dir)
|
if (plugin_dir)
|
||||||
{
|
{
|
||||||
var files = vimperator.io.readDirectory(plugin_dir);
|
var files = vimperator.io.readDirectory(plugin_dir.path);
|
||||||
vimperator.log("Sourcing plugin directory...", 3);
|
vimperator.log("Sourcing plugin directory...", 3);
|
||||||
files.forEach(function(file) {
|
files.forEach(function(file) {
|
||||||
if (!file.isDirectory())
|
if (!file.isDirectory())
|
||||||
|
|||||||
Reference in New Issue
Block a user