FileSystem Class
Layer for abstracting away differences in file systems. In the traditional case, the FileSystem is associated with a path on the actual filesystem, from which all other operations are considered relative. The FileSystem is also able to delegate operations to the ISO_FS library in the engine for reading / listing files off an ISO image instead of a file system.
Method Index
- _enumerate()
- _getFilePath(virtual_path, ...)
- fileExists(virtual_path, ...)
- fileSize(virtual_path, ...)
- fileUri(virtual_path, ...)
- isIso(name)
- listFiles(virtual_path, ...)
- readContents(virtual_path, ...)
- setRoot(physical_path)
Member Index
- files
- physical_path
- provider
- sub_dirs
function FileSystem:_enumerate()
Populate the files and sub_dirs values for the current FileSystem path.
Declared on: line 63 of Lua/filesystem.lua.
function FileSystem:_getFilePath(virtual_path, ...)
If the file exists and we are not using a provider then return a FileSystem
rooted in the directory that the directory the file is contained in.
Otherwise return nil and an error message.
Parameters:
| Name | Type | Description |
|---|---|---|
| virtual_path | ? | ? |
| ... | ? | ? |
Declared on: line 240 of Lua/filesystem.lua.
function FileSystem:fileExists(virtual_path, ...)
Determines if the given path points to a real file.
Parameters:
| Name | Type | Description |
|---|---|---|
| virtual_path | string | a path relative to the FileSystem root. |
| ... | string | the virtual_path may be split into separate arguments for each level in the filesystem. |
Declared on: line 183 of Lua/filesystem.lua.
function FileSystem:fileSize(virtual_path, ...)
Get the size of the file at the given path.
Parameters:
| Name | Type | Description |
|---|---|---|
| virtual_path | string | a path relative to the FileSystem root. |
| ... | string | the virtual_path may be split into separate arguments for each level in the filesystem. |
Declared on: line 203 of Lua/filesystem.lua.
function FileSystem:fileUri(virtual_path, ...)
Get a URI for the file.
The returned URI formats match those described by
Parameters:
Name Type Description
virtual_path
string
a path relative to the FileSystem root.
...
string
the virtual_path may be split into separate arguments
for each level in the filesystem.
Declared on: line 223 of Lua/filesystem.lua.
function FileSystem:isIso(name)
Test if file name has an .iso or .dmg extension
Parameters:
| Name | Type | Description |
|---|---|---|
| name | ? | ? |
Declared on: line 77 of Lua/filesystem.lua.
function FileSystem:listFiles(virtual_path, ...)
list the files in the given path.
Parameters:
| Name | Type | Description |
|---|---|---|
| virtual_path | string | a path relative to the FileSystem root. |
| ... | string | the virtual_path may be split into separate arguments for each level in the filesystem. |
Declared on: line 117 of Lua/filesystem.lua.
function FileSystem:readContents(virtual_path, ...)
Return the contents of the file at the given path.
Parameters:
| Name | Type | Description |
|---|---|---|
| virtual_path | string | a path relative to the FileSystem root. |
| ... | string | the virtual_path may be split into separate arguments for each level in the filesystem. |
Declared on: line 159 of Lua/filesystem.lua.
function FileSystem:setRoot(physical_path)
Set the root physical path for this FileSystem.
If the path is an ISO then set the provider. If the path is a directory
then set the physical_path and populate the files and sub_dirs.
Parameters:
| Name | Type | Description |
|---|---|---|
| physical_path | string | a path on the filesystem to either a directory or theme hospital ISO file. |
Declared on: line 87 of Lua/filesystem.lua.