Module os/env

os/env

Environment directory utilities.

Provides platform-aware paths for home, config, cache, and temp directories.

Example

{ home_dir, temp_dir } :: import "std/os/env";

home := home_dir();
tmp  := temp_dir();

Functions

home_dir function
fn() -> Option(String)

Return the current user's home directory, or .None if unavailable.

Returns: Option(String)

config_dir function
fn() -> Option(String)

Return the user-specific configuration directory.

  • Linux/macOS: $XDG_CONFIG_HOME or $HOME/.config
  • Windows: %APPDATA%

Returns: Option(String)

cache_dir function
fn() -> Option(String)

Return the user-specific cache directory.

  • Linux: $XDG_CACHE_HOME or $HOME/.cache
  • macOS: $HOME/Library/Caches
  • Windows: %LOCALAPPDATA%

Returns: Option(String)

temp_dir function
fn() -> String

Return the system temporary directory.

Returns: String