Fix lists of paths in posix environment (#7034)
Empty paths in a colon separated list would be considered as the current directory, so have to ensure $PATH and $LD_LIBRARY_PATH are not empty before separating it with :
This commit is contained in:
parent
e23ea64c41
commit
5492190bc6
6 changed files with 7 additions and 7 deletions
4
koch.nim
4
koch.nim
|
|
@ -97,7 +97,7 @@ proc exec(cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
|
|||
if not absolute.isAbsolute:
|
||||
absolute = getCurrentDir() / absolute
|
||||
echo("Adding to $PATH: ", absolute)
|
||||
putEnv("PATH", prevPath & PathSep & absolute)
|
||||
putEnv("PATH", (if prevPath.len > 0: prevPath & PathSep else: "") & absolute)
|
||||
echo(cmd)
|
||||
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
|
||||
putEnv("PATH", prevPath)
|
||||
|
|
@ -402,7 +402,7 @@ proc winReleaseArch(arch: string) =
|
|||
|
||||
template withMingw(path, body) =
|
||||
let prevPath = getEnv("PATH")
|
||||
putEnv("PATH", path & PathSep & prevPath)
|
||||
putEnv("PATH", (if path.len > 0: path & PathSep else: "") & prevPath)
|
||||
try:
|
||||
body
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue