0 issues 1 contributor 4 branches 0 releases
Additions: 1 Deletions: 6 View patch
1 // See: https://docs.microsoft.com/bg-bg/windows/win32/api/processenv/nf-processenv-getenvironmentstrings
2 // os.environ returns a map of all the current environment variables
3
4-fn unix_environ() &&char {
5- // TODO: remove this helper function, when `&&char(C.environ)` works properly
6- return voidptr(C.environ)
7-}
8-
9 pub fn environ() map[string]string {
10 mut res := map[string]string{}
11 $if windows {
12 }
13 C.FreeEnvironmentStringsW(estrings)
14 } $else {
15- start := unix_environ()
16+ start := &&char(C.environ)
17 mut i := 0
18 for {
19 x := unsafe { start[i] }
20