smelt.os¶
Tier: Host - Available in every runtime, including headless mode.
Visibility: Public - Stable Lua API intended for user config and plugins.
Environment and system primitives: getenv, setenv, platform, cwd, pid, etc.
smelt.os.arch¶
Return the target CPU architecture as reported by std::env::consts::ARCH (e.g. "x86_64", "aarch64").
smelt.os.cwd¶
Return the current working directory as (path, nil), or (nil, err_string) on failure.
smelt.os.exe_path¶
Return the filesystem path to the running smelt binary as (path, nil) on success, or (nil, err_string) on failure. Useful for plugins that re-exec the binary or report install location.
smelt.os.getenv¶
Return the value of the environment variable name, or nil if it is not set.
smelt.os.home¶
Return the user's home directory, or nil if it cannot be determined.
smelt.os.open_url¶
Open url in the system's default browser. Only http(s)://, mailto:, and file:// URLs are accepted. Returns (true, nil) on a successful spawn, or (false, err_string) if the scheme is rejected or every launcher errored.
smelt.os.open_url_if_available¶
Open url only when the host environment can auto-open a browser. Returns { opened = bool, error = string?, reason = string? }.
smelt.os.pid¶
Return the OS process id of the running smelt instance.
smelt.os.platform¶
Return the target operating system as reported by std::env::consts::OS (e.g. "macos", "linux").
smelt.os.set_cwd¶
Change the process working directory to p. Returns (true, nil) on success or (false, err_string) on failure.
smelt.os.setenv¶
Set the process environment variable name to value. Mutates the live process env; visible to subsequent getenv calls and child processes.
smelt.os.tempdir¶
Return the platform temporary directory path.
smelt.os.unsetenv¶
Remove the environment variable name from the process environment.