[Livehttpheaders] User Profile Directory install

Jerry Talkington jtalkington at users.sourceforge.net
Tue Dec 23 21:27:57 EST 2003


Here's a patch to install in a user's profile directory.  Registering in
the user's chrome.rdf was easy (by the undocumented but usable
PROFILE_CHROME switch,) but I wasn't sure if creating a components
directory in the profile dir would work.  It seems to work just fine.
I've been using it just fine with a modified install script.

Are the LiveHTTPHeaders.[xpm|ico] files still necessary?  They don't
seem to used, since favicon.ico is included in the jar...

I tried registering in bugzilla, but it still hasn't sent me a password,
which is why I'm sending the patch to the list.

-- 
GPG public key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x9D5B8762
-------------- next part --------------
Index: src/install.js
===================================================================
RCS file: /cvs/livehttpheaders/src/install.js,v
retrieving revision 1.6
diff -u -r1.6 install.js
--- src/install.js	21 Dec 2003 02:47:07 -0000	1.6
+++ src/install.js	24 Dec 2003 02:50:04 -0000
@@ -5,8 +5,9 @@
 const X_JAR_FILE = "livehttpheaders.jar";
 const X_COM_FILE = "nsHeaderInfo.js";
 
-const X_CHROME =   "chrome";
-const X_COMPONENTS = "components";
+var chromeFolder = getFolder("Profile", "chrome");
+var componentDir = getFolder("Profile", "components");
+var iconFolder = getFolder(getFolder("Profile", "icons"), "default");
 const X_CONTENT =  "content/";
 const X_SKIN = 	   "skin/";
 const X_LOCALE1 =  "locale/en-US/livehttpheaders/";
@@ -17,21 +18,20 @@
 logComment("Installation started...");
 
 resetError();
-addFile(X_NAME, X_JAR_FILE, getFolder(X_CHROME), "");
+addFile(X_NAME, X_JAR_FILE, chromeFolder, "");
 err = getLastError();
 if (err == SUCCESS || err == REBOOT_NEEDED) {
-  addFile(X_NAME_COM, X_COM_FILE, getFolder(X_COMPONENTS), "");
+  addFile(X_NAME_COM, X_COM_FILE, componentDir, "");
 }
 if (err == SUCCESS || err == REBOOT_NEEDED) {
-  var iconfolder = getFolder(getFolder(X_CHROME,"icons"), "default");
-  addFile(X_NAME, "LiveHTTPHeaders.xpm", iconfolder, "");
-  addFile(X_NAME, "LiveHTTPHeaders.ico", iconfolder, "");
+  addFile(X_NAME, "LiveHTTPHeaders.xpm", iconFolder, "");
+  addFile(X_NAME, "LiveHTTPHeaders.ico", iconFolder, "");
 }
 if (err == SUCCESS || err == REBOOT_NEEDED) {
-  registerChrome(DELAYED_CHROME | CONTENT, getFolder(X_CHROME, X_JAR_FILE), X_CONTENT);
-  registerChrome(DELAYED_CHROME | SKIN, getFolder(X_CHROME, X_JAR_FILE), X_SKIN);
-  registerChrome(DELAYED_CHROME | LOCALE, getFolder(X_CHROME, X_JAR_FILE), X_LOCALE1);
-  registerChrome(DELAYED_CHROME | LOCALE, getFolder(X_CHROME, X_JAR_FILE), X_LOCALE2);
+  registerChrome(PROFILE_CHROME | CONTENT, getFolder(chromeFolder, X_JAR_FILE), X_CONTENT);
+  registerChrome(PROFILE_CHROME | SKIN, getFolder(chromeFolder, X_JAR_FILE), X_SKIN);
+  registerChrome(PROFILE_CHROME | LOCALE, getFolder(chromeFolder, X_JAR_FILE), X_LOCALE1);
+  registerChrome(PROFILE_CHROME | LOCALE, getFolder(chromeFolder, X_JAR_FILE), X_LOCALE2);
 }
 err = getLastError();
 if (err == SUCCESS || err == REBOOT_NEEDED) {
@@ -46,8 +46,8 @@
   cancelInstall();
   if (err == -202) {
     alert("You need to have write permissions to the chrome directory and subfolders:\n" + 
-          getFolder(X_CHROME) + " and to the components directory:\n" +
-          getFolder(X_COMPONENTS));
+          chromeFolder + " and to the components directory:\n" +
+          componentDir);
   } else if (err == -210) {
     alert("Installation cancelled by user");
   }else {


More information about the Livehttpheaders mailing list