std/os
What a program asks about the machine it runs on (docs/design/OS.md): the environment it was started with, which
system and version it is, and where the user's files belong. The three target constants of std/core are
re-exported, so that a file that branches on the system writes one import.
EnvironmentandEnvironmentVariables- read one variable, list them all, split the search path.SystemandSystemVersion- the version, the host name, the uptime, the page size, the machine's architecture.Directories- home, configuration, data, state, cache and temporary files, by the convention of the system.OsError- what every question that can fail fails with.
A branch on the system is a match OperatingSystem.current: every arm is type checked on every machine, and only the
arm of the build's target is compiled. Each module above is such a branch, and each arm hands its question to a
directory of its own - windows/, linux/, macos/, freebsd/ for one system, posix/, bsd/, xdg/ for a
standard several share. Those directories hold the raw natives; torb check --every-target reports one that is
reached on a system it does not exist on.
Modules
std/os/directories[Directories]: where a user's files belong by the convention of the system - the home directory, and the bases for configuration, data, state, cache and temporary files.std/os/environmentThe environment this process was started with: [Environment] reads one variable, lists every one as a value, and splits the search path; [EnvironmentVariables] is that list as a value a program can change and hand on.std/os/error[OsError], what asking the operating system can go wrong with, and [outcome], the one function that turns the answer of a native ofruntime/os/into aResult.std/os/system[System] - which operating system this is and which version, the host name, how long it has been running, the size of a memory page and the architecture of the machine - and [SystemVersion], the name and version it answers.
Everything
- type
DirectoriesWhere a user's files belong, by the convention of the system. - type
EnvironmentThe environment this process was started with: read, listed, and handed on as a value. - type
EnvironmentVariablesA set of environment variables as a value. - type
OsErrorWhat asking the operating system went wrong with. - type
SystemWhich system this is, which version, and how long it has been running. - type
SystemVersionThe name and version of the running system.