Version 1 (modified by 16 years ago) ( diff ) | ,
---|
Summary A listing and description of VFS functions made available to Javascript, used to provide file information and access.
[KEEP IN SYNC WITH TDD AND CODE!]
VFS Global Functions
Scope: this documentation only covers the Javascript binding, not VFS itself.
These stateless functions provide basic file system access within the VFS sandbox. Expected use is in map/saved game selection dialogs; more complex tasks should utilize the complete vfs.h native code interface.
buildFileList
- Overview:
- Return an array of pathname strings, one for each matching entry in the specified directory.
- Syntax:
- pathnames = buildFileList(directory [, filter_string [, recurse]]);
- Parameters:
- directory: VFS path
- filter_string: default "" matches everything; otherwise, see vfs_next_dirent.
- recurse: should subdirectories be included in the search? default false.
- Returns:
- Array of matching pathnames
- Notes:
- Full pathnames of each file/subdirectory are returned, ready for use as a "filename" for the other functions.
getFileMTime
- Overview:
- Return time [seconds since 1970] of the last modification to the specified file.
- Syntax:
- mtime = getFileMTime(filename);
- Parameters:
- filename: VFS filename (may include path)
- Returns:
- Seconds-since-1970
- Notes:
getFileSize
- Overview:
- Return current size of file.
- Syntax:
- size = getFileSize(filename);
- Parameters:
- filename: VFS filename (may include path)
- Returns:
- Size in bytes
- Notes:
readFile
- Overview:
- Return file contents in a string.
- Syntax:
- contents = readFile(filename);
- Parameters:
- filename: VFS filename (may include path)
- Returns:
- String
- Notes:
readFileLines
- Overview:
- Return file contents as an array of lines.
- Syntax:
- lines = readFileLines(filename);
- Parameters:
- filename: VFS filename (may include path)
- Returns:
- Array of strings
- Notes:
Note:
See TracWiki
for help on using the wiki.