Search results

There are no results.

std.env

Methods for inspecting the OS process' environment.

This module provides methods for getting environment variables, the home directory, changing the working directory, etc.

Modifying variables

Modifying the current process' environment variables isn't supported, as this can introduce race conditions, or even unsound/undefined behaviour depending on the underlying platform.

Fortunately, the use-case for changing variables is rare and probably better served by using a sub process.

For more information:

Constants

ABI

The ABI of the operating system the code is compiled for.

ARCH

The architecture of the CPU the code is compiled for.

OS

The operating system the code is compiled for.

Methods

arguments

Returns an Array containing all the commandline arguments passed to the current program.

executable

Returns the path to the current executable.

home_directory

Returns the path to the current user's home directory.

opt

Returns an optional value of an environment variable.

temporary_directory

Returns the path to the temporary directory.

variables

Returns all defined environment variables and their values.

working_directory

Returns the current working directory.

working_directory=

Changes the current working directory to the given directory.