diskSpaceAvailable
Returns the amount of disk space available in bytes on the local disk.
Method of
File object
Syntax
double diskSpaceAvailable ( String NativeFolderPath );
Parameters
The diskSpaceAvailable method has the following parameters:
-
NativeFolderPath
- A string representing the pathname of the partition, a file, or a directory on the partition whose space is being queried.
Returns
A double number representing the amount of space, in bytes, on the queried drive.
Description
Use this function to make sure there is adequate space on the local disk for extracting and installing your files (see example below).
You can use a string representing any file on the disk you want to check, and XPInstall will resolve the reference to the partition itself.
Example
var diskAmtNeeded = 10000; f = getFolder("Program"); diskSpace = File.diskSpaceAvailable(f); g = getFolder(f, "myfile.txt"); if (diskSpace > diskAmtNeeded) { err = addFile(..., ... g, ...); if (err == 0) performInstall(); else cancelInstall(); } else { alert("not enough disk space. no install); cancelInstall(); }
Document Tags and Contributors
Last updated by:
Sheppy,