mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-12 23:15:46 +01:00
Mangle pathnames in the XPI to foil the fastload cache on upgrade and fix the command line option handler in fresh installs.
This commit is contained in:
@@ -5,53 +5,54 @@
|
||||
"use strict";
|
||||
|
||||
function reportError(e) {
|
||||
dump("dactyl: components: " + e + "\n" + (e.stack || Error().stack));
|
||||
dump("dactyl: command-line-handler: " + e + "\n" + (e.stack || Error().stack));
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
var global = this;
|
||||
var NAME = "command-line-handler";
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
|
||||
.getBranch("extensions.dactyl.");
|
||||
var appName = prefs.getComplexValue("appName", Ci.nsISupportsString).data;
|
||||
var name = prefs.getComplexValue("name", Ci.nsISupportsString).data;
|
||||
|
||||
function CommandLineHandler() {
|
||||
this.wrappedJSObject = this;
|
||||
|
||||
Cu.import("resource://dactyl/base.jsm");
|
||||
require(global, "util");
|
||||
require(global, "config");
|
||||
}
|
||||
CommandLineHandler.prototype = {
|
||||
|
||||
classDescription: appName + " Command-line Handler",
|
||||
classDescription: "Dactyl Command-line Handler",
|
||||
|
||||
classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
|
||||
|
||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=" + name,
|
||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl",
|
||||
|
||||
_xpcom_categories: [{
|
||||
category: "command-line-handler",
|
||||
entry: "m-" + name
|
||||
entry: "m-dactyl"
|
||||
}],
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
||||
|
||||
handle: function (commandLine) {
|
||||
|
||||
// TODO: handle remote launches differently?
|
||||
try {
|
||||
this.optionValue = commandLine.handleFlagWithParam(name, false);
|
||||
this.optionValue = commandLine.handleFlagWithParam(config.name, false);
|
||||
}
|
||||
catch (e) {
|
||||
dump(name + ": option '-" + name + "' requires an argument\n");
|
||||
util.dump("option '-" + config.name + "' requires an argument\n");
|
||||
}
|
||||
},
|
||||
|
||||
helpInfo: " -" + name + " <opts>" + " Additional options for " + appName + " startup\n".substr(name.length)
|
||||
get helpInfo() " -" + config.name + " <opts>" + " Additional options for " + config.appName + " startup\n".substr(config.name.length)
|
||||
};
|
||||
|
||||
if (XPCOMUtils.generateNSGetFactory)
|
||||
|
||||
Reference in New Issue
Block a user