summary refs log tree commit diff stats
path: root/tools/finish.nim
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2020-04-22 05:51:18 +0000
committerGitHub <noreply@github.com>2020-04-22 07:51:18 +0200
commit22418ce8fb07d6fd706b16656fba5e8c0e8ba2f4 (patch)
tree419899c56ab52e1a6bc172ccbb44384642b275b2 /tools/finish.nim
parenteb6f5237339e4f246118df750bc89624c4c42884 (diff)
downloadNim-22418ce8fb07d6fd706b16656fba5e8c0e8ba2f4.tar.gz
tools/finish: don't quote path with space (#14058) [backport]
Path with spaces should be added as is, quoting them makes utilities
treat the quotes as part of the path. This makes `nim` unable to be used
from the command line even if it appears to be added to user's Path
environment variable.

Even more confusing, Windows 10's PATH editor shows the path without any
quotes, you only see them when you use "Edit text". Took me a good 15
minutes to figure out why couldn't I run `nim` despite it being in Path.
Diffstat (limited to 'tools/finish.nim')
-rw-r--r--tools/finish.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/finish.nim b/tools/finish.nim
index ccbb698f4..4b5131045 100644
--- a/tools/finish.nim
+++ b/tools/finish.nim
@@ -123,12 +123,11 @@ when defined(windows):
 
   proc addToPathEnv*(e: string) =
     var p = tryGetUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER)
-    let x = if e.contains(Whitespace): "\"" & e & "\"" else: e
     if p.len > 0:
       p.add ";"
-      p.add x
+      p.add e
     else:
-      p = x
+      p = e
     setUnicodeValue(r"Environment", "Path", p, HKEY_CURRENT_USER)
 
   proc createShortcut(src, dest: string; icon = "") =