Fixes for #7747 - finish.exe issues (#7748)

This commit is contained in:
genotrance
2018-05-02 12:16:44 -05:00
committed by Andreas Rumpf
parent 21cbf438ce
commit 452321874d

View File

@@ -52,14 +52,17 @@ when defined(windows):
proc askBool(m: string): bool =
stdout.write m
while true:
let answer = stdin.readLine().normalize
case answer
of "y", "yes":
return true
of "n", "no":
return false
else:
echo "Please type 'y' or 'n'"
try:
let answer = stdin.readLine().normalize
case answer
of "y", "yes":
return true
of "n", "no":
return false
else:
echo "Please type 'y' or 'n'"
except EOFError:
quit(1)
proc askNumber(m: string; a, b: int): int =
stdout.write m
@@ -99,10 +102,6 @@ when defined(windows):
proc addToPathEnv*(e: string) =
var p = tryGetUnicodeValue(r"Environment", "Path", HKEY_CURRENT_USER)
if p.len == 0:
p = tryGetUnicodeValue(
r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
"Path", HKEY_LOCAL_MACHINE)
let x = if e.contains(Whitespace): "\"" & e & "\"" else: e
if p.len > 0:
p.add ";"
@@ -189,8 +188,10 @@ when defined(windows):
proc main() =
when defined(windows):
let desiredPath = expandFilename(getCurrentDir() / "bin")
let p = getUnicodeValue(r"Environment", "Path",
HKEY_CURRENT_USER)
let p = tryGetUnicodeValue(r"Environment", "Path",
HKEY_CURRENT_USER) & ";" & tryGetUnicodeValue(
r"System\CurrentControlSet\Control\Session Manager\Environment", "Path",
HKEY_LOCAL_MACHINE)
var alreadyInPath = false
var mingWchoices: seq[string] = @[]
var incompat: seq[string] = @[]
@@ -199,7 +200,7 @@ proc main() =
let y = try: expandFilename(if x[0] == '"' and x[^1] == '"':
substr(x, 1, x.len-2) else: x)
except: ""
if y == desiredPath: alreadyInPath = true
if y.cmpIgnoreCase(desiredPath) == 0: alreadyInPath = true
if y.toLowerAscii.contains("mingw"):
if dirExists(y):
if checkGccArch(y): mingWchoices.add y