| 1 | ''' Summary ''' |
| 2 | A listing and description of VFS functions made available to Javascript, used to provide file information and access. |
| 3 | |
| 4 | [KEEP IN SYNC WITH TDD AND CODE!] |
| 5 | |
| 6 | = VFS Global Functions = |
| 7 | |
| 8 | Scope: this documentation only covers the Javascript binding, not VFS itself. |
| 9 | |
| 10 | 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. |
| 11 | |
| 12 | == buildFileList == |
| 13 | * '''Overview:''' |
| 14 | * Return an array of pathname strings, one for each matching entry in the specified directory. |
| 15 | * '''Syntax:''' |
| 16 | * pathnames = buildFileList(directory [, filter_string [, recurse]]); |
| 17 | * '''Parameters:''' |
| 18 | * directory: VFS path |
| 19 | * filter_string: default "" matches everything; otherwise, see vfs_next_dirent.[[BR]] |
| 20 | * recurse: should subdirectories be included in the search? default false. |
| 21 | * '''Returns:''' |
| 22 | * Array of matching pathnames |
| 23 | * '''Notes:''' |
| 24 | * Full pathnames of each file/subdirectory are returned, ready for use as a "filename" for the other functions. |
| 25 | |
| 26 | == getFileMTime == |
| 27 | * '''Overview:''' |
| 28 | * Return time [seconds since 1970] of the last modification to the specified file. |
| 29 | * '''Syntax:''' |
| 30 | * mtime = getFileMTime(filename); |
| 31 | * '''Parameters:''' |
| 32 | * filename: VFS filename (may include path) |
| 33 | * '''Returns:''' |
| 34 | * Seconds-since-1970 |
| 35 | * '''Notes:''' |
| 36 | |
| 37 | == getFileSize == |
| 38 | * '''Overview:''' |
| 39 | * Return current size of file. |
| 40 | * '''Syntax:''' |
| 41 | * size = getFileSize(filename); |
| 42 | * '''Parameters:''' |
| 43 | * filename: VFS filename (may include path) |
| 44 | * '''Returns:''' |
| 45 | * Size in bytes |
| 46 | * '''Notes:''' |
| 47 | |
| 48 | == readFile == |
| 49 | * '''Overview:''' |
| 50 | * Return file contents in a string. |
| 51 | * '''Syntax:''' |
| 52 | * contents = readFile(filename); |
| 53 | * '''Parameters:''' |
| 54 | * filename: VFS filename (may include path) |
| 55 | * '''Returns:''' |
| 56 | * String |
| 57 | * '''Notes:''' |
| 58 | |
| 59 | == readFileLines == |
| 60 | * '''Overview:''' |
| 61 | * Return file contents as an array of lines. |
| 62 | * '''Syntax:''' |
| 63 | * lines = readFileLines(filename); |
| 64 | * '''Parameters:''' |
| 65 | * filename: VFS filename (may include path) |
| 66 | * '''Returns:''' |
| 67 | * Array of strings |
| 68 | * '''Notes:''' |