fs
is_empty
bool fs.is_empty(string path)
Returns true if the provided file or directory is empty
Example Usage
local empty = fs.is_empty(--[[path]])
is_directory
bool fs.is_directory(string path)
Returns true if the provided path is a directory
Example Usage
local directory = fs.is_directory(--[[path]])
is_regular_file
bool fs.is_regular_file(string path)
Returns true if the provided path is a regular file
Example Usage
local regular_file = fs.is_regular_file(--[[path]])
get_workspace_path
string fs.get_workspace_path()
Returns a path the script may use for any dynamic content
Example Usage
local workspace_path = fs.get_workspace_path() -- example: "C:\\Users\\Default\\AppData\\Roaming\\Exodus Client\\Library\\Red Dead Redemption 2\\Client\\Scripting\\Workspace"
get_assets_path
string fs.get_assets_path()
Returns a path the script may use for any static content
Example Usage
local assets_path = fs.get_assets_path() -- example: "C:\\Users\\Default\\AppData\\Roaming\\Exodus Client\\Library\\Red Dead Redemption 2\\Client\\Scripting\\Assets"
get_extension
string fs.get_extension(string path)
Returns the extension of a provided path
Example Usage
local extension = fs.get_extension(--[[path]])
get_filename
string fs.get_filename(string path)
Returns the filename of a provided path
Example Usage
local filename = fs.get_filename(--[[path]])
create_directory
void fs.create_directory(string path)
Creates a single directory using the provided path
Example Usage
fs.create_directory(fs.get_workspace_path() .. "\\Dir") -- create a single directory in workspace
create_directories
void fs.create_directories(string path)
Creates multiple directories using the provided path
Example Usage
fs.create_directories(fs.get_workspace_path() .. "\\Dir\\Dir") -- create multiple directories in workspace
list_directory
string[] fs.list_directory(string path, bool recursive)
Returns an array of all regular files and directories in a provided path, 'recursive' will also search all subdirectories
Example Usage
for i, path in ipairs(fs.list_directory(fs.get_workspace_path(), true)) do
if fs.is_directory(path) then
if fs.is_empty(path) then
log.info("Empty Dir: " .. path)
else
log.info("Dir: " .. path)
end
end
end
file_size
int fs.file_size(string path)
Returns the size of the provided file
Example Usage
local size = fs.file_size(--[[path]])
exists
bool fs.exists(string path)
Returns true if the provided file or directory exists
Example Usage
local exists = fs.exists(--[[path]])