Unpacks a single subcomponent into a temporary location. Queues the subcomponent for addition to the Client Version Registry and installation to its final destination.
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);
addFile method has the following parameters:
The 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 as
executable. 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 the
initInstallmethod. This parameter can also be null, in which case the
xpiSourcePathparameter 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.
An 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.
- A string specifying the location of the file within the XPI file.
An 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
A 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 or
NULL, xpiSourcePathis used.
- An optional field; reserved for future use. Pass 0 as the default value.
An integer error code. For a list of possible values, see Return Codes.
addFile method 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.
var xpiSrc = "file.txt"; initInstall("Adding a File", "addFile", "220.127.116.11", 1); f = getFolder("Program"); setPackageFolder(f); addFile(xpiSrc); if (0 == getLastError()) performInstall(); else cancelInstall();