Eric Plaster wrote:Thanks. This is just what I needed to know. I tried it, and it worked great.>
> How do I write the install.js? Everything I tried seemed to be wrong.
> The document on xpinstall on netscapes site was good at explaining the
> API, but short on examples. I've included the install.js for
> spellviewer. If someone could tell me how to get it installed in a
> "dndtools" directory and be able to launch it with "./mozilla -chrome
> chrome://spellviewer/content", I would be most greatfull.Assuming your attached install.js works, to put it down a level you need to
change the addFile() command and the registerChrome() commands to point to
the new location.addFile() you can change by supplying the fourth argument
"dndtools/spellviewer.jar" -- but if you supply anything there it has to be
a relative filename, not just a directory name. A better option might be to
specify a target dirvar instDir = getFolder("Chrome","dndtools");
then in your addFile replace "getFolder('Chrome')" with "instDir".
Now in your registerChrome you use getFolder(instDir,"spellviewer.jar"), or
my preference, replace the whole thing with a single variablevar chromeFile = getFolder(instDir, "spellviewer.jar");
and then use that in the three registerChrome calls.
Ya, I didn't like it either (I stole it from mozcalc!). I was planning on going back and cleaning it up. I just needed to get something working, so I can play with it.I don't really like the structure of your script -- if the initInstall()
fails you shouldn't bother doing anything else. But in particular
performInstall() doesn't always return SUCCESS, and if it doesn't you will
then invalidly call cancelInstall().So at least restructure the last bit
if ( err == SUCCESS ) {
performInstall();
}
else {
cancelInstall(err);
}One non-error status performInstall() can return is 999, meaning everything
appeared to go OK, but it's not installed until you restart because some
file was in-use that you tried to overwrite. This typically happens on an
upgrade, for instance.
Yep> BTW, being able to register it as "dndtools/spellviewer" would also be
> very helpfull to avoid name conflicts.Oh yeah, your gName sucks ;-)
This is exactly what I wanted to do. Every example I looked at though had just the name of there application. I tried veriations, but I didn't know if this was causing the script to fail or other parts. Anyway, it's good to know I can do this.Let's call it gRegName to drive the point home, and for registry names you
need to try to spread out the namespace. Strongly encouraged are things of
the form [<type>/]<company>/<product>. For example, we install Flash using
the key "Plugins/Macromedia/Shockwave Flash".If this is a work project I'd recommend
"Chrome/QLogic/dndtools/spellviewer", and if it's personal maybe
"Chrome/Eric Plaster/dndtools/spellviewer"
The documentation on netscape is very vague on these points. Anyway, I cleaned up the script and attached my new install.js if anyone is interested (perhaps a peer review?)-Dan Veditz
Thanks again,
eric
-- ---- Eric Plaster Urban Rage Software Senior Software Engineer (612)555-5555 [EMAIL PROTECTED] http://www.urbanrage.com
S/MIME Cryptographic Signature
