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.
This commit is contained in:
parent
eb6f523733
commit
22418ce8fb
1 changed files with 2 additions and 3 deletions
|
|
@ -123,12 +123,11 @@ when defined(windows):
|
||||||
|
|
||||||
proc addToPathEnv*(e: string) =
|
proc addToPathEnv*(e: string) =
|
||||||
var p = tryGetUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER)
|
var p = tryGetUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER)
|
||||||
let x = if e.contains(Whitespace): "\"" & e & "\"" else: e
|
|
||||||
if p.len > 0:
|
if p.len > 0:
|
||||||
p.add ";"
|
p.add ";"
|
||||||
p.add x
|
p.add e
|
||||||
else:
|
else:
|
||||||
p = x
|
p = e
|
||||||
setUnicodeValue(r"Environment", "Path", p, HKEY_CURRENT_USER)
|
setUnicodeValue(r"Environment", "Path", p, HKEY_CURRENT_USER)
|
||||||
|
|
||||||
proc createShortcut(src, dest: string; icon = "") =
|
proc createShortcut(src, dest: string; icon = "") =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue