Symlinks are now expanded in os.getAppFilename on Mac OS X.
This commit is contained in:
parent
2bb4a853ec
commit
d23d14897a
1 changed files with 5 additions and 0 deletions
|
|
@ -1368,6 +1368,9 @@ when defined(macosx):
|
||||||
|
|
||||||
proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} =
|
proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} =
|
||||||
## Returns the filename of the application's executable.
|
## Returns the filename of the application's executable.
|
||||||
|
##
|
||||||
|
## This procedure will resolve symlinks.
|
||||||
|
##
|
||||||
## **Note**: This does not work reliably on BSD.
|
## **Note**: This does not work reliably on BSD.
|
||||||
|
|
||||||
# Linux: /proc/<pid>/exe
|
# Linux: /proc/<pid>/exe
|
||||||
|
|
@ -1397,6 +1400,8 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} =
|
||||||
result = newString(int(size))
|
result = newString(int(size))
|
||||||
if getExecPath2(result, size):
|
if getExecPath2(result, size):
|
||||||
result = "" # error!
|
result = "" # error!
|
||||||
|
if result.len > 0:
|
||||||
|
result = result.expandFilename
|
||||||
else:
|
else:
|
||||||
# little heuristic that may work on other POSIX-like systems:
|
# little heuristic that may work on other POSIX-like systems:
|
||||||
result = string(getEnv("_"))
|
result = string(getEnv("_"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue