Moai SDK
2.0
|
|
Creates a folder at 'path' if none exists.
function affirmPath ( string path )
string | path |
|
Check for the existence of a file.
function checkFileExists ( string filename )
string | filename |
|
Check for the existence of a path.
function checkPathExists ( string path )
string | path |
|
Copy a file or directory to a new location.
function copy ( string srcPath, string destPath )
string | srcPath |
string | destPath |
|
Deletes a directory and all of its contents.
function deleteDirectory ( string path [, boolean recursive ] )
string | path |
boolean | recursive Optional. If true, the directory and all contents beneath it will be purged. Otherwise, the directory will only be removed if empty. |
|
Deletes a file.
function deleteFile ( string filename )
string | filename |
|
Returns the absolute path given a relative path.
function getAbsoluteDirectoryPath ( string path )
string | path |
|
Returns the absolute path to a file. Result includes the file name.
function getAbsoluteFilePath ( string filename )
string | filename |
|
Given an absolute path returns the relative path in relation to the current working directory or a user supplied 'base' directory.
function getRelativePath ( string path [, string base ] )
string | path |
string | base Optional. |
|
Given a virtual path, return the path to the archive and, if the path is to a file, the offset to the file record within the archive.
function getVirtualPathInfo ( string path [, string offsetToHeader, number uncompressedSize, number compressedSize ] )
string | path A virtual path. |
string | offsetToHeader Optional. Offset to the file record header in the archive, or nil if not a file path. |
number | uncompressedSize Optional. Uncompressed size of the file or nil if not a file path. |
number | compressedSize Optional. Compressed size of the file or nil if not compressed or not a file path. |
|
Returns the path to current working directory.
function getWorkingDirectory ()
|
Lists the sub-directories contained in a directory.
function listDirectories ( [ string path ] )
string | path Optional. Path to search. Default is current directory. |
|
Lists the files contained in a directory.
function listFiles ( [ string path ] )
string | path Optional. Path to search. Default is current directory. |
|
Open and read the entirity of a file into a string.
function loadFile ( string filename )
string | filename |
|
Mount an archive as a virtual filesystem directory.
function mountVirtualDirectory ( string path [, string archive ] )
string | path Virtual path. |
string | archive Optional. Name of archive file to mount. Default value is nil. |
|
Renames a file or folder.
function rename ( string oldPath, string newPath )
string | oldPath |
string | newPath |
|
Create or overwrite a file to contain the contents of a given string.
function saveFile ( string filename [, string contents ] )
string | filename |
string | contents Optional. |
|
Sets the current working directory.
function setWorkingDirectory ( string path )
string | path |
|
Strip the timestamp from a pkzip file. Useful in systems where periodically generated pkzip files are compared against each other using hashes. Once timestamps are stripeed, two pkzip files with the same contents should produce identical hashes.
function stripPKZipTimestamps ( string infilename, string outfilename )
string | infilename |
string | outfilename |