summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-06 23:38:29 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-06 23:38:29 +0200
commite067a7681fd8db93e51fa65569829b8c485c6bfe (patch)
tree8e19ea1504ef0ca308e5923f0e88b36f5b4b6340 /compiler
parente555e97b4b9a561e14b1c5441e85db9167d03a87 (diff)
downloadNim-e067a7681fd8db93e51fa65569829b8c485c6bfe.tar.gz
'nimcache' defaults to ~/.cache on Posix; cleaned up documentation
Diffstat (limited to 'compiler')
-rw-r--r--compiler/options.nim14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index 7d7327d28..4931b4330 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -480,9 +480,19 @@ proc disableNimblePath*(conf: ConfigRef) =
 
 include packagehandling
 
+proc getOsCacheDir(): string =
+  when defined(posix):
+    result = getHomeDir() / ".cache"
+  else:
+    result = getHomeDir() / genSubDir
+
 proc getNimcacheDir*(conf: ConfigRef): string =
-  result = if conf.nimcacheDir.len > 0: conf.nimcacheDir
-           else: shortenDir(conf, conf.projectPath) / genSubDir
+  result = if conf.nimcacheDir.len > 0:
+             conf.nimcacheDir
+           elif conf.cmd == cmdCompileToJS:
+             shortenDir(conf, conf.projectPath) / genSubDir
+           else: getOsCacheDir() / conf.projectName &
+             (if isDefined(conf, "release"): "_r" else: "_d")
 
 proc pathSubs*(conf: ConfigRef; p, config: string): string =
   let home = removeTrailingDirSep(os.getHomeDir())