addFile
Unpacks a single subcomponent into a temporary location. Queues the subcomponent for addition to the Client Version Registry and installation to its final destination.
Method of
Syntax
public int addFile ( String registryName, InstallVersion version, String xpiSourcePath, Object localDirSpec, String relativeLocalPath, Boolean forceUpdate); public int addFile ( String registryName, String version, String xpiSourcePath, Object localDirSpec, String relativeLocalPath, Boolean forceUpdate); public int addFile ( String xpiSourcePath); public int addFile ( String registryName, String xpiSourcePath, Object localDirSpec, String relativeLocalPath); public int addFile ( String registryName, String version, String xpiSourcePath, Object localDirSpec, String relativeLocalPath);Parameters
The
addFilemethod has the following parameters:
registryNameThe pathname in the Client Version Registry about the file. This parameter can be an absolute pathname, such as /royalairways/RoyalSW/executableor a relative pathname, such asexecutable. Typically, absolute pathnames are only used for shared components, or components that come from another vendor, such as/Microsoft/shared/msvcrt40.dll. Typically, relative pathnames are relative to the main pathname specified in theinitInstallmethod. This parameter can also be null, in which case thexpiSourcePathparameter is used as a relative pathname. Note that the registry pathname is not the location of the software on the machine; it is the location of information about the software inside the Client Version Registry.versionAn InstallVersion object or a Stringof up to four integer values delimited by periods, such as "1.17.1999.1517". For variants or this method without a version argument the value from initInstall will be used.xpiSourcePathA string specifying the location of the file within the XPI file. localDirSpecAn object representing a directory. The file is installed under this directory on the user's machine. You create this object by passing a string representing the directory to the getFoldermethod.relativeLocalPathA pathname relative to the localDirSpecparameter. The file is installed in this location on the user's machine. You must always use forward slashes (/) in this pathname, regardless of the convention of the underlying operating system. If this parameter is blank orNULL, xpiSourcePathis used.flagsAn optional field; reserved for future use. Pass 0 as the default value. Returns
An integer error code. For a list of possible values, see Return Codes.
Description
The
addFilemethod puts the file in a temporary location. To move this and all other files to their final location, call the performInstall method after you've successfully added all files.Note: If you are installing binary files on a Macintosh, be aware that the binary format for those files must be AppleSingle if the resource information is to be installed properly. Some file transfer programs will convert Apple binaries to this format on transfer if you transfer them from a Macintosh to a Unix/Windows machine before zipping up those files on that target system.
Example
var xpiSrc = "file.txt"; initInstall("Adding a File", "addFile", "1.0.1.7", 1); f = getFolder("Program"); setPackageFolder(f); addFile(xpiSrc); if (0 == getLastError()) performInstall(); else cancelInstall();
| Netscape Communications devedge.netscape.com |