luz-system¶
System utilities included with Luz. No installation needed.
Platform¶
is_windows()¶
Returns true if running on Windows.
is_linux()¶
Returns true if running on Linux.
is_mac()¶
Returns true if running on macOS.
path_sep()¶
Returns the path separator for the current OS (\ on Windows, / elsewhere).
Path¶
path_join(base, ...parts)¶
Joins path components using the OS separator.
path_basename(p)¶
Returns the last component of a path (filename or directory name).
path_dirname(p)¶
Returns everything except the last component of a path.
path_ext(p)¶
Returns the file extension including the dot.
path_exists(p)¶
Returns true if the path exists (file or directory).
Process¶
run(command)¶
Runs a shell command and returns its output. Raises an error if the command exits with a non-zero code.
try_run(command)¶
Runs a command silently. Returns true if it succeeded (exit code 0), false otherwise.
sysinfo()¶
Prints OS, hostname, username, PID, and current working directory to stdout.