- filesystem.getFileName()
- filesystem.getFilePath()
- filesystem.directoryExists()
- filesystem.fileExists()
- filesystem.getDirectory()
- filesystem.isDirectory()
- filesystem.createDirectory()
- filesystem.fixSlashes()
- filesystem.getOpenFileName()
- filesystem.getSaveFileName()
- filesystem.getCWD()
- filesystem.setCWD()
Returns just the filename (no path) section of a full path.
@code() local path = "C:\\micromacro\\scripts\\test.lua"; print(filesystem.getFileName(path)); -- This should print "test.lua" to the console @endcodeReturns just the path (no filename) section of a full path. Does not include trailing slash (/).
@code() local path = "C:\\micromacro\\scripts\\test.lua"; print(filesystem.getFilePath(path)); -- This should print "C:\micromacro\scripts" to the console @endcodeIf the given directory specified by 'path' exists, this function returns
If the given file specified by 'path' exists, this function returns
If the given directory does not exist or contains no files, this function fails. Otherwise, it
returns a
The returned table does not distinguish between files and directories. You may wish to iterate over the table and check them independently using filesystem.isDirectory()
@code() table.print(filesystem.getDirectory('C:/micromacro')); @endcode @code() 1: "alut.dll" 2: "config.default.lua" 3: "config.lua" 4: "lib" 5: "libncurses5.dll" 6: "license.txt" 7: "logs" 8: "lua53.dll" 9: "micromacro.exe" 10: "OpenAL32.dll" 11: "scripts" 12: "sqlite3.dll" 13: "src" @endcode()If the given 'path' is a directory, this function returns
Creates a new directory at 'path'. This function is recursive and will create additional directories
as necessary. Returns
Convert slashes within 'path' to '/' (POSIX standard) or '\' (Windows only).
If 'posix' is
Displays the standard open file dialog. 'defaultfilename' can contain a full path to the default file.
'filter' should be properly formatted: Split key/value pairs with
This works exactly like filesystem.getOpenFileName() except that it shows the dialog for saving a file.
Returns the current working directory. This will be the directory that MicroMacro is currently executing a script from.
@code() print("CWD:", filesystem.getCWD()); -- Prints out something like: -- CWD: C:/micromacro/scripts @endcodeModify the current working directory (CWD) to the given path.
You probably don't want to do this under normal conditions and it is not recommended unless you know what you're doing, otherwise unknown behavior could occur.
Page last updated at 2018-09-25 20:47:31