summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-23 17:55:00 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-23 17:55:00 +0200
commit1c3cfd74fff010b6759a27ce44f01bf08159d418 (patch)
tree3331447d101fd66fd233c44d484a8f0b2657eb5a /lib
parent361a2d830aca1959d3dbc15d13bea31f89fcd0e2 (diff)
downloadNim-1c3cfd74fff010b6759a27ce44f01bf08159d418.tar.gz
make ospaths compile; fixes ospaths.getConfigDir for Posix
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/ospaths.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/pure/ospaths.nim b/lib/pure/ospaths.nim
index 0414eae5d..1bcfd978b 100644
--- a/lib/pure/ospaths.nim
+++ b/lib/pure/ospaths.nim
@@ -531,9 +531,11 @@ proc getConfigDir*(): string {.rtl, extern: "nos$1",
   ##
   ## An OS-dependent trailing slash is always present at the end of the
   ## returned string; `\\` on Windows and `/` on all other OSs.
-  when defined(windows): return string(getEnv("APPDATA")) & "\\"
-  elif getEnv("XDG_CONFIG_HOME"): return string(getEnv("XDG_CONFIG_HOME")) & "/"
-  else: return string(getEnv("HOME")) & "/.config/"
+  when defined(windows):
+    result = string(getEnv("APPDATA")) & "\\"
+  else:
+    result = string(getEnv("XDG_CONFIG_HOME", "")) & "/"
+    if result == "/": result = string(getEnv("HOME")) & "/.config/"
 
 proc getTempDir*(): string {.rtl, extern: "nos$1",
   tags: [ReadEnvEffect, ReadIOEffect].} =