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!]

Pyrogenesis Object Model : VFS (Virtual File System) Interface

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.

VFS functions

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
Last modified 16 years ago Last modified on Feb 23, 2008, 8:58:08 PM
Note: See TracWiki for help on using the wiki.