** Summary ** A listing and description of VFS functions made available to Javascript, used to provide file information and access.
[IN SYNC WITH TDD AND CODE!]KEEP
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 [since 1970]seconds 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*