[Project_owners] How to use install.js to write to all.js file?

HJ bugs4hj at netscape.net
Thu Dec 25 13:03:04 EST 2003


"Matthew A. McGuigan" <mmcguigan at webnugget.com> wrote:

>Hello all,
>
>I'm new to extension writing.  I need to write a string to the all.js 
>file and I can't seem to find the Mozilla facility to do this.  The XPI 
>API lists writeString as a function, but the documentation states it is 
>Windows only.  In addition to that, it appears to be built just for 
>modifying Windows ini files, not Mozilla js files.  I didn't find a way 
>of writing to js files in the XPInstall.pdf.  Any help is greatly 
>appreciated.
>
>Best regards and happy holidays everyone,
>Matthew

There are several ways to solve your problem:

First, you could use: SetDefaultIntPref(in string pref, in long value);

see also: http://lxr.mozilla.org/seamonkey/source/modules/libpref/public/nsIPref.idl#233

but I won't use this because you should stay out of all.js A better solution, and this is the preferred way to do it, is to change the pref setting in prefs.js [user.js] by simply writing your pref setting. with:

pref.setIntPref(in string pref, in long value);

You could also create a pref file called projectname.js and dump it in 
mozilla/defaults/pref during the XPInstall process. This is the best way to override default pref settings. Simply copy the pref setting(s) from all.js 
and paste it into this file and adjust the setting(s).

Hope this helps,

Mele Kalikimaka, Feliz Navidad, Joyeux Noël, Frohe Weihnachten, Gelukkig Kerstfeest or simply Merry Christmas.

/HJ

__________________________________________________________________
New! Unlimited Access from the Netscape Internet Service.
Beta test the new Netscape Internet Service for only $1.00 per month until 3/1/04.
Sign up today at http://isp.netscape.com/register
Act now to get a personalized email address!

Netscape. Just the Net You Need.


More information about the Project_owners mailing list