Module os - leonard-thieu/monkey GitHub Wiki
The os module provides miscellaneous operating system functionality, such as file, directory and environment variable access.
FILETYPE_DIR : Int
FILETYPE_FILE : Int
FILETYPE_NONE : Int
AppArgs : String[] ()
AppPath : String ()
ChangeDir : Int ( path:String )
CopyDir : Int ( srcpath:String, dstpath:String, recursive:Bool, hidden:Bool )
CopyFile : Int ( src:String, dst:String )
CreateDir : Int ( path:String )
CurrentDir : String ()
DeleteDir : Int ( path:String )
DeleteDir : Int ( path:String, recursive:Bool )
DeleteFile : Int ( path:String )
Execute : Int ( cmd:String )
ExitApp : Int ( retcode:Int )
ExtractDir : String ( path:String )
ExtractExt : String ( path:String )
FileSize : Int ( path:String )
FileTime : Int ( path:String )
FileType : Int ( path:String )
GetEnv : String ( name:String )
HostOS : String ()
LoadDir : String[] ( path:String )
LoadDir : String[] ( path:String, recursive:Bool, hidden:Bool )
LoadString : String ( path:String )
RealPath : String ( path:String )
SaveString : Int ( str:String, path:String )
SetEnv : Int ( name:String, value:String )
StripAll : String ( path:String )
StripDir : String ( path:String )
StripExt : String ( path:String )
The os module provides miscellaneous operating system functionality, such as file, directory and environment variable access.
The os module also includes several string processing functions for extracting various components from file system paths such as directory and file extension.
IMPORTANT: The os module is currently only available for the glfw and stdcpp targets.
Returns the application startup parameters.
Function AppPath : String ()
Returns the file system path of the currently running application.
Changes the current directory of the running application.
Copies the directory at srcpath to dstpath, creating dstpath if necessary.
If recursive is True, then subdirectories are also copied.
If hidden is True, then hidden files - files starting with a dot - are also copied.
Copies a file from srcpath to dstpath.
Create a new directory at path.
Function CurrentDir : String ()
Returns the current directory of the currently running application.
Deletes the directory at path.
If recursive is True, then subdirectories are also deleted - use with care!
Deletes the directory at path.
If recursive is True, then subdirectories are also deleted - use with care!
Deletes the specified file.
Executes a shell command and returns the result. This is generally 0 for success, or non-0 for failure.
Exits the application with the given return code.
In general, ExitApp should return 0 if successful, or <0 upon failure.
Extracts and returns the directory of a file system path.
Extracts and returns the file type extension of a file system path.
Return the length of a file, in bytes.
Returns the time the file at path was last modified.
Returns an integer representing the type of a file, one of: 0 for no file, 1 for a normal file, 2 for a directory.
Gets an environment variable.
Function HostOS : String ()
Returns a string describing the host operating system. The returned value will be one of:
HostOS | Operating system |
---|---|
winnt |
Windows |
macos |
MacOS |
linux |
Linux |
Function LoadDir : String[] ( path:String )
Loads the file names in the directory specified by path into a string array.
If recursive is True, LoadDir will also load file names in subdirectories, but will not add subdirectories to the output string array.
If hidden is True, then hidden files - files starting with a dot - are also loaded.
Loads the file names in the directory specified by path into a string array.
If recursive is True, LoadDir will also load file names in subdirectories.
If hidden is True, then hidden files - files starting with a dot - are also loaded.
Loads a string from the file at path.
Returns the real, or 'absolute', file system path corresponding to the given path.
Saves str to a file specified by path.
If a file already exists at path, it will be overwritten.
Sets an environment variable.
Removes both the directory and file extension from a file system path, returning just the file name.
Removes the directory from a file system path, and returns the file name and extension.
Extracts and returns the file extension of a file system path.