Pathing
A binding of the rust Path for lulu.
Methods
pathing.new(string): Creates a newPath.Path:join(string): Returns a newPathwith the joined result.Path:append(string): Returns the selfPathbut appends the provided string.Path:to_string(): Returns the path as string.Path:exists(): Checks if the path exists.Path:is_file(): Checks if the path is a file.Path:is_dir(): Checks if the path is a dir.Path:filename(): Gets the filename.Path:extension(): Gets the file extension.Path:stem(): Gets the file stem.Path:parent(): Gets the file parent dir.Path:components(): Gets the components of the path.Path:list(): Gets all files in the path.Path:ensure_dir(): Creates the folder if does not exist.Path:ensure_file(string): Creates the file with provided content if does not exist.Path:ensure(string?): If provided a string then it will create a file in the specified path if that path does not exist, otherwise will create a folder.
pathing.root(): ReturnsPathof the root of the system.pathing.appdata(): ReturnsPathof the appdata of the system.pathing.cache(): ReturnsPathof the cache path of the system.pathing.program_files(): ReturnsPathof the program files folder of the system.pathing.temp(): ReturnsPathof the temp folder of the system.
Usage
using {
lulib.pathing
}
local path = pathing.appdata()
:join("my-app")
:ensure()
print(path)