Home arrow XML arrow Page 3 - Creating an XUL App Installer
XML

Creating an XUL App Installer


It is surprisingly easy to package and create an installer for a XUL application that you've written. Anyone who uses your application will thank you for it; it will save them a lot of time and effort. Keep reading to see how it's done.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
May 22, 2006
TABLE OF CONTENTS:
  1. · Creating an XUL App Installer
  2. · Getting Started
  3. · The Installation Process
  4. · Packaging Your Files

print this article
SEARCH DEVARTICLES

Creating an XUL App Installer - The Installation Process
(Page 3 of 4 )

To start the installation process, we need to initialize it and provide the chrome registry with the registry key:

initInstall(appName, "/"+author+"/"+chromeName, version);

The initInstall method takes the plain-text, or friendly, name of your application, followed by '/author name/application name/' which should match the information in the main contents.rdf file.

To tell XPInstall where to copy your application files to, you use the getFolder method to obtain the target directory, and the setPackageFolder method to set it as the target directory:

installDir = getFolder("Chrome","");
setPackageFolder(installDir);

The addFile method assigns a source file to be copied to the target directory.  It takes just one parameter; the name of the source file:

addFile(file);

You can also use the addFolder method to assign the source files for the installation if your XPI archive contains a directory structure instead of a JAR file.

You now need to specify what information is added to the installed-chrome file, a key element of the chrome-registry.  This is done using the registerChrome method which takes three parameters: what to install and how to install it, where the files can be found, and the path to the files:

registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome",
file), contentPath);
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome",
file), localePath);

Note that skin packages normally reside within their own JAR archives, which is why I haven't specified a SKIN| DELAYED_CHROME install.  DELAYED_CHROME means that the new chrome will be installed once Mozilla has been restarted (when the chrome.rdf file is regenerated).

Finally, the performaInstall method is called, which actually performs the installation.  This is the point where the specified files are actually copied, and the necessary file updates occur:

performInstall();


blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials