MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
Your Search Results

    addFile

    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

    Install object

    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 addFile method has the following parameters:

    registryName
    The pathname in the Client Version Registry about the file. This parameter can be an absolute pathname, such as /royalairways/RoyalSW/executable or 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 initInstall method. This parameter can also be null, in which case the xpiSourcePath parameter 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.
    version
    An InstallVersion object or a String of 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.
    xpiSourcePath
    A string specifying the location of the file within the XPI file.
    localDirSpec
    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 getFolder method.
    relativeLocalPath
    A pathname relative to the localDirSpec parameter. 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, xpiSourcePath is used.
    flags
    An 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 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.

    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();

    Document Tags and Contributors

    Contributors to this page: Sheppy, Fredchat, trevorh, Rod Whiteley
    Last updated by: Sheppy,
    Hide Sidebar