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

add 'exrc'

This commit is contained in:
Doug Kearns
2008-10-21 15:45:57 +00:00
parent b58c04200f
commit 2141d475f8
6 changed files with 27 additions and 4 deletions

View File

@@ -478,10 +478,12 @@ function IO() //{{{
return dirs;
},
getRCFile: function ()
getRCFile: function (dir)
{
var rcFile1 = ioManager.getFile("~/." + EXTENSION_NAME + "rc");
var rcFile2 = ioManager.getFile("~/_" + EXTENSION_NAME + "rc");
dir = dir || "~";
let rcFile1 = ioManager.getFile(joinPaths(dir, "/." + EXTENSION_NAME + "rc"));
let rcFile2 = ioManager.getFile(joinPaths(dir, "/_" + EXTENSION_NAME + "rc"));
if (WINDOWS)
[rcFile1, rcFile2] = [rcFile2, rcFile1];

View File

@@ -63,6 +63,10 @@ const liberator = (function () //{{{
"Ring the bell when an error message is displayed",
"boolean", false);
options.add(["exrc", "ex"],
"Allow reading of an RC file in the current directory",
"boolean", false);
const tabopts = [
["n", "Tab number", null, ".hl-TabNumber"],
["N", "Tab number over icon", null, ".hl-TabIconNumber"],
@@ -1168,13 +1172,20 @@ const liberator = (function () //{{{
// make sourcing asynchronous, otherwise commands that open new tabs won't work
setTimeout(function () {
var rcFile = io.getRCFile();
let rcFile = io.getRCFile("~");
if (rcFile)
io.source(rcFile.path, true);
else
liberator.log("No user RC file found", 3);
if (options["exrc"])
{
let localRcFile = io.getRCFile(io.getCurrentDirectory());
if (localRcFile)
io.source(localRcFile.path, true);
}
if (options["loadplugins"])
liberator.loadPlugins();