Filesystem Module

From SolarStrike wiki
Revision as of 17:44, 30 May 2014 by Elverion (talk | contribs) (Created page with "== directoryExists == '''boolean filesystem.directoryExists(string path)''' If the given directory exists, returns true. Else, returns false. == fileExists == '''boolean fi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

directoryExists

boolean filesystem.directoryExists(string path)

If the given directory exists, returns true. Else, returns false.


fileExists

boolean filesystem.fileExists(string path)

If the given file exists, returns true. Else, returns false.


getDirectory

table filesystem.getDirectory(string path)

If the given directory does not exist, this function fails. Otherwise, returns a table of filenames & directories contained in this path. This does not include "." and ".."


isDirectory

boolean filesystem.isDirectory(string path)

If the given path is a directory, returns true. Else, returns false.


makeDirectory

boolean filesystem.makeDirectory(string path)

Creates a directory at 'path'. Returns true on success, else false.


fixSlashes

string filesystem.fixSlashes(string path[, boolean posix])

Convert slashes within 'path' to / (POSIX standard) or \ (Windows only).

If posix is true (default), converts backslashes(\) to forward slashes(/). Else, converts forward slashes to backslashes.


getOpenFileName

string filesystem.getOpenFileName(string defaultFilename[, string filter])

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 NULL (\0), terminate with double NULL(\0\0). Multiple filetypes should be split with semicolon (;). For example:

filter = "All Files\0*.*\0Lua files\0*.lua\0Image files\0*.bmp;*.jpg\0\0";
filesystem.getOpenFileName("", filter);


If the user cancels the dialog, this function fails and returns nil.


getSaveFileName

string filesystem.getSaveFileName(string defaultFilename[, string filter])

This works exactly like filesystem.getOpenFileName() except that it shows the dialog for saving a file.


getCWD

string filesystem.getCWD()

Returns the current working directory. This should be the directory that MicroMacro is currently executing a script from.


setCWD

filesystem.getCWD()

Modify the current working directory (CWD) to the given path. You probably don't want to do this under normal conditions.