1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-25 00:51:21 +00:00
freebsd-ports/lang/nimrod/files/patch-lib-pure-os.nim
Tijl Coosemans b6021e2573 Add a patch so the port no longer requires procfs.
PR:		ports/188326
Approved by:	Neal Nelson <ports@nicandneal.net> (maintainer)
2014-04-16 19:12:50 +00:00

37 lines
1.5 KiB
Nim

--- lib/pure/os.nim.orig
+++ lib/pure/os.nim
@@ -1389,8 +1389,6 @@
result = getApplAux("/proc/self/exe")
elif defined(solaris):
result = getApplAux("/proc/" & $getpid() & "/path/a.out")
- elif defined(freebsd):
- result = getApplAux("/proc/" & $getpid() & "/file")
elif defined(macosx):
var size: cuint32
getExecPath1(nil, size)
@@ -1399,16 +1397,14 @@
result = "" # error!
else:
# little heuristic that may work on other POSIX-like systems:
- result = string(getEnv("_"))
- if len(result) == 0:
- result = string(ParamStr(0))
- # POSIX guaranties that this contains the executable
- # as it has been executed by the calling process
- if len(result) > 0 and result[0] != DirSep: # not an absolute path?
- # iterate over any path in the $PATH environment variable
- for p in split(string(getEnv("PATH")), {PathSep}):
- var x = joinPath(p, result)
- if ExistsFile(x): return x
+ result = string(ParamStr(0))
+ # POSIX guaranties that this contains the executable
+ # as it has been executed by the calling process
+ if len(result) > 0 and result[0] != DirSep: # not an absolute path?
+ # iterate over any path in the $PATH environment variable
+ for p in split(string(getEnv("PATH")), {PathSep}):
+ var x = joinPath(p, result)
+ if ExistsFile(x): return x
proc getApplicationFilename*(): string {.rtl, extern: "nos$1", deprecated.} =
## Returns the filename of the application's executable.