summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorDennis Felsing <dennis@felsin9.de>2018-01-08 10:49:00 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-01-08 10:49:00 +0100
commit5492190bc63326069233a8aaf9f2e567cfc555f8 (patch)
tree2b1c4c802a60ca97b72798a461329f24d30913a6 /koch.nim
parente23ea64c41e101d4e1d933f0b015f51cc6c2f7de (diff)
downloadNim-5492190bc63326069233a8aaf9f2e567cfc555f8.tar.gz
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 :
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/koch.nim b/koch.nim
index 7bb7ea402..d51b902ee 100644
--- a/koch.nim
+++ b/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: