fixes #17; I hope!
This commit is contained in:
parent
62b4cc6c02
commit
6fdb0f034e
1 changed files with 17 additions and 4 deletions
|
|
@ -41,8 +41,8 @@ when defined(Nimdoc): # only for proper documentation:
|
||||||
## For example: '.' for POSIX or ':' for the classic Macintosh.
|
## For example: '.' for POSIX or ':' for the classic Macintosh.
|
||||||
|
|
||||||
ParDir* = ".."
|
ParDir* = ".."
|
||||||
## The constant string used by the operating system to refer to the parent
|
## The constant string used by the operating system to refer to the
|
||||||
## directory.
|
## parent directory.
|
||||||
##
|
##
|
||||||
## For example: ".." for POSIX or "::" for the classic Macintosh.
|
## For example: ".." for POSIX or "::" for the classic Macintosh.
|
||||||
|
|
||||||
|
|
@ -698,13 +698,26 @@ when defined(windows):
|
||||||
envComputed = true
|
envComputed = true
|
||||||
discard FreeEnvironmentStringsA(env)
|
discard FreeEnvironmentStringsA(env)
|
||||||
|
|
||||||
|
else:
|
||||||
|
when defined(macosx):
|
||||||
|
# From the manual:
|
||||||
|
# Shared libraries and bundles don't have direct access to environ,
|
||||||
|
# which is only available to the loader ld(1) when a complete program
|
||||||
|
# is being linked.
|
||||||
|
# The environment routines can still be used, but if direct access to
|
||||||
|
# environ is needed, the _NSGetEnviron() routine, defined in
|
||||||
|
# <crt_externs.h>, can be used to retrieve the address of environ
|
||||||
|
# at runtime.
|
||||||
|
proc NSGetEnviron(): cstringArray {.
|
||||||
|
importc: "_NSGetEnviron", header: "<crt_externs.h>".}
|
||||||
else:
|
else:
|
||||||
var gEnv {.importc: "environ".}: cstringArray
|
var gEnv {.importc: "environ".}: cstringArray
|
||||||
# var gEnv {.importc: "gEnv".}: cstringArray
|
|
||||||
|
|
||||||
proc getEnvVarsC() =
|
proc getEnvVarsC() =
|
||||||
# retrieves the variables of char** env of C's main proc
|
# retrieves the variables of char** env of C's main proc
|
||||||
if not envComputed:
|
if not envComputed:
|
||||||
|
when defined(macosx):
|
||||||
|
var gEnv = NSGetEnviron()
|
||||||
var i = 0
|
var i = 0
|
||||||
while True:
|
while True:
|
||||||
if gEnv[i] == nil: break
|
if gEnv[i] == nil: break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue