File

The File object can be used to manipulate files. Like the Install functions, the functions of the File object only assign an operation to be performed once the installation has begun.

Most functions take a file or folder as an argument. This argument must be one returned by the Install.getFolder function.

This object is only available in an installation script.

More information about File


Properties and Methods:

copy ( source , dest )

Assigns a file to be copied. The file specified by source is copied to the location specified by dest.

dirCreate ( folder )

Assigns the directory referred to by the folder argument to be created. This folder must have been returned by the Install.getFolder function.

dirGetParent ( folder )

Returns the parent directory of the folder argument. This folder must have been returned by the Install.getFolder function.

dirRemove ( folder , recurse )

Assigns the directory referred to by the folder argument to be removed. If recurse is set to true, the directory is deleted recursively. If false, the directory is only deleted if it is empty.

dirRename ( folder , newname )

Assigns the directory referred to by the folder argument to be renamed. The newname argument should be set to a string that contains the new name of the directory.

diskSpaceAvailable ( folder )

Returns the number of bytes of available space on the disk on which the given folder is located on.

execute ( file , args )

Assigns a file to be executed during the installation. You may optionally specify arguments. This function is not the same as the Install.execute function. That function runs files from inside the installer archive only. This function is used to run files which are already on disk.

exists ( file )

Returns true if the file exists.

isDirectory ( folder )

Returns true if the given folder is a reference to a directory.

isFile ( file )

Returns true if the given folder is a reference to a file.

macAlias ( sourceFolder , sourceFile , aliasFolder )

Assigns a Macintosh shortcut to another file be created. On non-Macintosh systems, this function does nothing. Arguments are as follows:

sourceFolderRefers to the folder containing the file which the alias points to. This argument must be returned by getFolder.
sourceFileA string that holds the filename of the alias.
aliasFolderRefers to the location of the new alias. This argument must be returned by getFolder.

modDate ( file )

Returns the last modified date of the given file. The date is returned as a number, which you can then pass to the JavaScript Date object.

modDateChanged ( file , date )

Returns true if last modified date of the given file is different than the date given by the second argument. This might be used to compare versions of files.

move ( source , dest )

Assigns a file given by source to be moved to a different location given by dest.

nativeVersion ( file )

remove ( file )

Assigns a file to be removed.

rename ( file , newname )

Assigns the file referred to by the file argument to be renamed. The newname argument should be set to a string that contains the new name of the file.

size ( file )

Returns the size in bytes of the given file.

unixLink ( source , flags )

windowsRegisterServer ( folder )

Used to register Windows COM servers. The argument folder should refer to the library file.

windowsShortcut ( target , shortcut , desc , workingDir , args , icon , iconid )

Assigns a Windows shortcut to another file to be created. On non-Windows systems, this function does nothing. Arguments are as follows:

targetA string that holds the target of the shortcut.
shortcutA string that holds the path and filename of the shortcut.
descThe description of the shortcut.
workingDirThe working directory of the shortcut, when it is executed, assuming that the shortcut points to an executable file.
argsThe arguments passed to the shortcut when executed.
iconA string that holds the path of the file that contains the shortcut's icon.
iconidThe ID of the icon within the icon file.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com