InstallFile

Installs and uncompresses a file.

Syntax:

InstallFile(filename, targname, default-targdir, delete-old, flags)

Parameters:

(s) filename source file to be installed. (path optional, short , 8.3 version required)

(s) targname the name of the target file to be created. (without path)

(s) default-targdir directory where the file is to be installed.

(i) delete-old @TRUE - to delete existing same name files.; @FALSE - to ignore existing same name files.

(i) flags 1 - shared file; 2 - force install 

Returns:

(s)  "result|tempname", or "result|"

 

When installing 32-bit image files (EXE's, DLL's, etc.), this function uses the version information embedded in the files to determine whether a file being installed is newer than an existing file with the same name. When installing any other type of file, which does not contain appropriate version information, this function uses the time stamps of the respective files instead.

The return value is in the form:

"result|tempname", or

"result|"

where "result" is the value returned by the "VerInstallFile" Windows API function; and "tempname" is the name of the temporary file that was created if the file could not be installed, or blank otherwise.

"Default-targdir" is the directory where you want the file to be installed. The file will be installed to this directory, unless it is a shared file or a file with the same name already exists elsewhere.

If "Delete-old" is @TRUE (or non-zero), and a file with the same name as the file being installed already exists, it will be deleted, even if it is located in a directory (on the path) other than the target directory. If "delete-old" is @FALSE, such a file will not be deleted.

"Flags" specifies other optional flags that affect the operation of this function, combined with the OR ('|') operator. They are:

1 - shared file (file should be installed to a shared directory)

2 - force install (install file even if older than existing file)

Note: InstallFile can uncompress files compressed by the Microsoft setup compress utility. The image version can only be interpreted by a corresponding platform version, i.e. 32-bit images by a 32-bit platform.

Example:


InstallFile("a:\ctl3d.dl_","ctl3d.dll", DirWindows(1), @TRUE, 1)
;or in the case of a long filename:
InstallFile(FileNameShort("a:\carved stone.bm_"), "carved~1.bmp",DirWindows(0), @TRUE, 1|2)
DirChange(DirWindows(0))
FileRename("carved~1.bmp", "carved stone.bmp")
See Also:

FileCopy, RegApp