This commit is contained in:
Araq 2019-08-16 14:48:32 +02:00
commit b9dd972c32

View file

@ -17,6 +17,12 @@ type
Manual, Manual,
Success Success
proc expand(s: string): string =
try:
result = expandFilename(s)
except OSError, IOError:
result = s
proc unzip(): bool = proc unzip(): bool =
if not fileExists("dist" / mingw): if not fileExists("dist" / mingw):
echo "Could not find ", "dist" / mingw echo "Could not find ", "dist" / mingw
@ -192,19 +198,21 @@ when defined(windows):
let bits = $(sizeof(pointer)*8) let bits = $(sizeof(pointer)*8)
for d in dirs: for d in dirs:
if dirExists d: if dirExists d:
let x = expandFilename(d / "bin") let x = expand(d / "bin")
if checkGccArch(x): return x if x.len != 0:
else: incompat.add x if checkGccArch(x): return x
else: incompat.add x
elif dirExists(d & bits): elif dirExists(d & bits):
let x = expandFilename((d & bits) / "bin") let x = expand((d & bits) / "bin")
if checkGccArch(x): return x if x.len != 0:
else: incompat.add x if checkGccArch(x): return x
else: incompat.add x
proc main() = proc main() =
when defined(windows): when defined(windows):
let nimDesiredPath = expandFilename(getCurrentDir() / "bin") let nimDesiredPath = expand(getCurrentDir() / "bin")
let nimbleBin = getEnv("USERPROFILE") / ".nimble" / "bin" let nimbleBin = getEnv("USERPROFILE") / ".nimble" / "bin"
let nimbleDesiredPath = try: expandFilename(nimbleBin) except: nimbleBin let nimbleDesiredPath = expand(nimbleBin)
let p = tryGetUnicodeValue(r"Environment", "Path", let p = tryGetUnicodeValue(r"Environment", "Path",
HKEY_CURRENT_USER) & ";" & tryGetUnicodeValue( HKEY_CURRENT_USER) & ";" & tryGetUnicodeValue(
r"System\CurrentControlSet\Control\Session Manager\Environment", "Path", r"System\CurrentControlSet\Control\Session Manager\Environment", "Path",