| 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 | == Pyrogenesis Object Model : VFS (Virtual File System) Interface == |
| 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 | === VFS functions === |
| 13 | |
| 14 | ==== buildFileList ==== |
| 15 | Overview:: |
| 16 | Return an array of pathname strings, one for each matching entry in the specified directory. |
| 17 | Syntax:: |
| 18 | pathnames = buildFileList(directory [, filter_string [, recurse]]); |
| 19 | Parameters:: |
| 20 | directory: VFS path[[BR]] |
| 21 | filter_string: default "" matches everything; otherwise, see vfs_next_dirent.[[BR]] |
| 22 | recurse: should subdirectories be included in the search? default false. |
| 23 | Returns:: |
| 24 | Array of matching pathnames |
| 25 | Notes:: |
| 26 | Full pathnames of each file/subdirectory are returned, ready for use as a "filename" for the other functions. |
| 27 | |
| 28 | |
| 29 | ==== getFileMTime ==== |
| 30 | Overview:: |
| 31 | Return time [seconds since 1970] of the last modification to the specified file. |
| 32 | Syntax:: |
| 33 | mtime = getFileMTime(filename); |
| 34 | Parameters:: |
| 35 | filename: VFS filename (may include path) |
| 36 | Returns:: |
| 37 | Seconds-since-1970 |
| 38 | Notes:: |
| 39 | |
| 40 | |
| 41 | ==== getFileSize ==== |
| 42 | Overview:: |
| 43 | Return current size of file. |
| 44 | Syntax:: |
| 45 | size = getFileSize(filename); |
| 46 | Parameters:: |
| 47 | filename: VFS filename (may include path) |
| 48 | Returns:: |
| 49 | Size in bytes |
| 50 | Notes:: |
| 51 | |
| 52 | |
| 53 | ==== readFile ==== |
| 54 | Overview:: |
| 55 | Return file contents in a string. |
| 56 | Syntax:: |
| 57 | contents = readFile(filename); |
| 58 | Parameters:: |
| 59 | filename: VFS filename (may include path) |
| 60 | Returns:: |
| 61 | String |
| 62 | Notes:: |
| 63 | |
| 64 | |
| 65 | ==== readFileLines ==== |
| 66 | Overview:: |
| 67 | Return file contents as an array of lines. |
| 68 | Syntax:: |
| 69 | lines = readFileLines(filename); |
| 70 | Parameters:: |
| 71 | filename: VFS filename (may include path) |
| 72 | Returns:: |
| 73 | Array of strings |
| 74 | Notes:: |