Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

XPInstall API Reference:Install Object:Methods:addDirectory

addDirectory

Unpacks an entire directory into a temporary location.

Method of

Install object

Syntax

public int addDirectory (
   String xpiSourcePath);

public int addDirectory (
   String registryName,
   String xpiSourcePath,
   Object localDirSpec,
   String relativeLocalPath);

public int addDirectory (
   String registryName,
   String version,
   String xpiSourcePath,
   Object localDirSpec,
   String relativeLocalPath);

public int addDirectory (
   String registryName,
   String version,
   String xpiSourcePath,
   Object localDirSpec,
   String relativeLocalPath,
   Boolean forceUpdate);

public int addDirectory (
   String registryName,
   InstallVersion version,
   String xpiSourcePath,
   Object localDirSpec,
   String relativeLocalPath,
   Boolean forceUpdate);

Parameters

The addDirectory method has the following parameters:

registryName
The pathname in the Client Version Registry for the root directory of the files that are to be installed.This parameter can be an absolute pathname (beginning with a /) or a relative pathname, (not beginning with a slash). An absolute pathname is used as specified. A relative pathname is appended to the registry name of the package as specified by the package parameter to 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 computer; 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 of this method without a version argument the value from initInstall will be used.
xpiSourcePath
A string specifying the location of the directory within the XPI file.An empty string ("") causes the creation of a subdirectory node in the registry without actually unpacking any files, which may be useful when you are updating a package that contains subcomponents that could also be updated separately. When xpiSourcePath is an empty string, registryName cannot be null.
localDirSpec
An object representing a directory. The file is installed under this directory on the user's computer. You create this object by passing a string representing the directory to the getFolder method.
subdir
The name of a directory to append to localDirSpec, using '/' as the path separator regardless of the platform.If subdir is missing, null, or "", the filenames are appended directly to the folder name specified by localDirSpec.
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. In some situations, addDirectory may return other errors.

Description

The addDirectory method puts the files in the specified directory in a temporary location. To move the files and all other subcomponents to their final location, call the performInstall method after you've successfully added all subcomponents. Also see the note about binaries on the Macintosh platform in addFile.

Document Tags and Contributors

 Last updated by: Anonymous,