mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 08:25:45 +01:00
Remove useless extensionName variable and trap errors at initialization.
This commit is contained in:
@@ -2024,39 +2024,43 @@ const Dactyl = Module("dactyl", {
|
|||||||
// finally, read the RC file and source plugins
|
// finally, read the RC file and source plugins
|
||||||
// make sourcing asynchronous, otherwise commands that open new tabs won't work
|
// make sourcing asynchronous, otherwise commands that open new tabs won't work
|
||||||
util.timeout(function () {
|
util.timeout(function () {
|
||||||
let extensionName = config.idname;
|
let init = services.get("environment").get(config.idname + "_INIT");
|
||||||
let init = services.get("environment").get(extensionName + "_INIT");
|
|
||||||
let rcFile = io.getRCFile("~");
|
let rcFile = io.getRCFile("~");
|
||||||
|
|
||||||
if (dactyl.commandLineOptions.rcFile) {
|
try {
|
||||||
let filename = dactyl.commandLineOptions.rcFile;
|
if (dactyl.commandLineOptions.rcFile) {
|
||||||
if (!/^(NONE|NORC)$/.test(filename))
|
let filename = dactyl.commandLineOptions.rcFile;
|
||||||
io.source(io.File(filename).path, false); // let io.source handle any read failure like Vim
|
if (!/^(NONE|NORC)$/.test(filename))
|
||||||
}
|
io.source(io.File(filename).path, false); // let io.source handle any read failure like Vim
|
||||||
else {
|
}
|
||||||
if (init)
|
|
||||||
dactyl.execute(init);
|
|
||||||
else {
|
else {
|
||||||
if (rcFile) {
|
if (init)
|
||||||
io.source(rcFile.path, true);
|
dactyl.execute(init);
|
||||||
services.get("environment").set("MY_" + extensionName + "RC", rcFile.path);
|
else {
|
||||||
|
if (rcFile) {
|
||||||
|
io.source(rcFile.path, true);
|
||||||
|
services.get("environment").set("MY_" + config.idname + "RC", rcFile.path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dactyl.log("No user RC file found", 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options["exrc"] && !dactyl.commandLineOptions.rcFile) {
|
||||||
|
let localRCFile = io.getRCFile(io.cwd);
|
||||||
|
if (localRCFile && !localRCFile.equals(rcFile))
|
||||||
|
io.source(localRCFile.path, true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
dactyl.log("No user RC file found", 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options["exrc"] && !dactyl.commandLineOptions.rcFile) {
|
if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins)
|
||||||
let localRCFile = io.getRCFile(io.cwd);
|
options["loadplugins"] = false;
|
||||||
if (localRCFile && !localRCFile.equals(rcFile))
|
|
||||||
io.source(localRCFile.path, true);
|
if (options["loadplugins"])
|
||||||
}
|
dactyl.loadPlugins();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
dactyl.reportError(e, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins)
|
|
||||||
options["loadplugins"] = false;
|
|
||||||
|
|
||||||
if (options["loadplugins"])
|
|
||||||
dactyl.loadPlugins();
|
|
||||||
|
|
||||||
// after sourcing the initialization files, this function will set
|
// after sourcing the initialization files, this function will set
|
||||||
// all gui options to their default values, if they have not been
|
// all gui options to their default values, if they have not been
|
||||||
|
|||||||
Reference in New Issue
Block a user