dams wrote: > Hi, This is rather urgent question > > I have my xpinstaller on the cdrom, and nearby, a directory called > 'data' : ls /mnt/cdrom or dir d: returns: > > my-installer.exe > data/ > > I want some xpi to install the content of datas into some directory on > the hard disk. So I try to ass some lines in the package.jst, according to > http://developer.netscape.com/docs/manuals/xpinstall/xpinstal.html
If you're installing from a CD drive you might be better off using the native install stubs (mozilla/xpinstall/wizard) which probably have more flexibility for you. > The problem is that I fail at using the function 'copy' > ( http://developer.netscape.com/docs/manuals/xpinstall/File6.html#997895 ) > > I don't know how to get a fil in the FileSpecObject format, other than > calling getFolder, that returns only folder. And copy doesn't copy > entire folders :/ getFolder() actually can return file references, we've debated renaming it or creating a getFile() synonym. But you're right that copy only copies single files and there is no directory copy. The File object methods were hacked in somewhat after the fact because someone wanted/needed them. They weren't central to the mission of getting files out of the .xpi delivery method and onto the user's disk so they were never a high priority. Sounds like you want something along the lines of File.dirCopy( sourceDir, targetDir [, recursive] ) File.enumerate( dir [, recursive[, glob-pattern]] ) Short of someone volunteering to implement them (they wouldn't be hard) they're not likely to happen any time soon. > -Or How to construct a FileSpecObject from a file (give its path) If you know it's path you can construct a object using getFolder("file:///", <rest-of-path>) the <rest-of-path> should be in file:/// URL format, although as a special case on windows a windows native path happens to work. On Unix you'd have to strip the root '/', and on Mac convert ':' to '/' > -Do you know examples that do similar things? Not the directory copying, but the "file:///" url is used all over in the Mozilla install scripts for windows, http://lxr.mozilla.org/mozilla/source/xpinstall/packager/windows/browser.jst You asked in mail how to get the location of the install archive. the "archive" property in an install script will give you a folder object that represents the archive. In a downloaded .xpi that will be some temporary location, but for a local archive (such as on a CD-ROM) it'll be the original location. There's also a "url" property. If it's a file: url then it's a local archive and you can strip the path part and feed it into getFolder("file:///", ...) as mentioned above. If you're shipping the .XPI file on a CD anyway I don't see why you don't just add the directory to the .xpi. If you don't need it, fine, don't call addDirectory() on that directory, no loss. If it's intended to be a downloaded .xpi I can see why you'd want to avoid that... in that case do your best to determine your condition before download and split it into two .xpi files installed together, or have a couple of alternate versions. -Dan Veditz
