In my quest to create a packager for XULRunner apps, I figured I should use the Autotools to package up the app and distribute it as a tarball. This will allow the developer to distribute on any flavor of Linux, and the end-user will just need to do the standard untar, configure, make, install.
For Autotools, I must use several command-line tools, autoscan, autoconf, and automake, and since im using it through my XUL app, I must reference to /usr/bin/ which is where these tools are stored.
var appRootDir= Components.classes[“@mozilla.org/file/local;1”]
var process = Components.classes[“@mozilla.org/process/util;1”]
var args = [targetPath];
process.run(true, args, args.length);
Where ‘appRootDir’ is an instance nsILocalFile, Initalize the path as the root directory ‘//’
Append the each directory and the command to the root
Create an instance of nsIProcess
Initalize the process with the path to the command
Include any agruments in a separate variable, in this case I used the directory of where I want to package
Finally just run the process
This method works perfectly if you want to run command-line utilities in the directory you are working in, or in this case where the command takes in a source. Unfortunatly, autoconf and automake don’t seem to work if you are not in the working directory.