diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-06-22 00:15:07 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2013-06-22 00:15:07 +0100 |
commit | d23d14897a6249dd6b03c7fc525f42bfac2b6700 (patch) | |
tree | bc8caf31c83e7764afdfbeeb841536e97a37fd96 /lib/pure | |
parent | 2bb4a853ecef114ce9a5fcf08ea5bc5ffff2aae0 (diff) | |
download | Nim-d23d14897a6249dd6b03c7fc525f42bfac2b6700.tar.gz |
Symlinks are now expanded in os.getAppFilename on Mac OS X.
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/os.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index bf00afed2..de4893f8c 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1368,6 +1368,9 @@ when defined(macosx): proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} = ## Returns the filename of the application's executable. + ## + ## This procedure will resolve symlinks. + ## ## **Note**: This does not work reliably on BSD. # Linux: /proc/<pid>/exe @@ -1397,6 +1400,8 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} = result = newString(int(size)) if getExecPath2(result, size): result = "" # error! + if result.len > 0: + result = result.expandFilename else: # little heuristic that may work on other POSIX-like systems: result = string(getEnv("_")) |