Make -d:tempDir switch work once again [bugfix] (#11442)

Fixes https://github.com/nim-lang/Nim/issues/11441.
This commit is contained in:
Kaushal Modi 2019-06-09 02:54:15 -04:00 • committed by Andreas Rumpf
commit 3c62d41468

View file

@ -798,12 +798,13 @@ proc getTempDir*(): string {.rtl, extern: "nos$1",
## * `expandTilde proc <#expandTilde,string>`_ ## * `expandTilde proc <#expandTilde,string>`_
## * `getCurrentDir proc <#getCurrentDir>`_ ## * `getCurrentDir proc <#getCurrentDir>`_
## * `setCurrentDir proc <#setCurrentDir,string>`_ ## * `setCurrentDir proc <#setCurrentDir,string>`_
const tempDirDefault = "/tmp/"
when defined(tempDir): when defined(tempDir):
const tempDir {.strdefine.}: string = nil const tempDir {.strdefine.}: string = tempDirDefault
return tempDir return tempDir
elif defined(windows): return string(getEnv("TEMP")) & "\\" elif defined(windows): return string(getEnv("TEMP")) & "\\"
elif defined(android): return getHomeDir() elif defined(android): return getHomeDir()
else: return "/tmp/" else: return tempDirDefault
proc expandTilde*(path: string): string {. proc expandTilde*(path: string): string {.
tags: [ReadEnvEffect, ReadIOEffect].} = tags: [ReadEnvEffect, ReadIOEffect].} =