# improve handling of environment variables on Windows · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0

Requested commit: cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0

Commit: cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0

Tree: 342ef6e97cd6f0a3a65839ab0b5e5326a9ea296d

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
improve handling of environment variables on Windows

std.os.getenv and std.os.getenvZ have nice compile errors when not linking
libc and using Windows.

std.os.getenvW is provided as a Windows-only API that does not require
an allocator. It uses the Process Environment Block.
std.process.getEnvVarOwned is improved to be a simple wrapper on top of
std.os.getenvW.

std.process.getEnvMap is improved to use the Process Environment Block
rather than calling GetEnvironmentVariableW.

std.zig.system.NativePaths uses process.getEnvVarOwned instead of
std.os.getenvZ, which works on Windows as well as POSIX.

```

## Parents

- [936d0b18b116ea126893d2f165f9be72f8bef845](https://git.cafe/gitcafe/zig/commit/936d0b18b116ea126893d2f165f9be72f8bef845?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0?format=markdown)
