Module env

env

Process environment: command-line arguments, environment variables, and current working directory.

Mirrors the layout of Rust's std::env. Platform/architecture detection and child-process spawning live in std/process.

Functions

raw_args function
fn() -> [*(u8)]

Get raw command-line arguments as a slice of C strings. The first element is the program name.

Returns: [*(u8)]

argc function
fn() -> i32

Get the number of command-line arguments (including program name).

Returns: i32

argv function
fn() -> *(*(u8))

Get the raw argv pointer (*(*(u8))).

Returns: *(*(u8))

args function
fn() -> ArrayList(String)

Get command-line arguments as an ArrayList(String). The first element is the program name.

Returns: ArrayList(String)

cwd function
fn() -> Result(Path, String)

Get the current working directory as a Path. Returns Err with a message on failure.

Returns: Result(Path, String)

chdir function
fn(path : Path) -> Result(unit, String)

Change the current working directory to path. Returns Ok(()) on success, or Err with a message on failure.

Parameters

NameTypeNotes
pathPath

Returns: Result(unit, String)

Constants

env constant env

Environment variable access and manipulation.

Value: env(get: <fn get>, set: <fn set>)