summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-08-11 13:30:51 -0700
committerGitHub <noreply@github.com>2021-08-11 13:30:51 -0700
commitc94933acb7a8fe08e1ef479d02bd20732ea1ea23 (patch)
treeca45dd90f42e1bb40dc6c45be1f402e911bd8ffa
parentbc14b7735929f764b09446073375174236fab161 (diff)
downloadNim-c94933acb7a8fe08e1ef479d02bd20732ea1ea23.tar.gz
fix #18674 --nimcache now works better with --os:windows (#18675)
-rw-r--r--compiler/commands.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 1c3de29ba..82e908152 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -537,6 +537,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     conf.lazyPaths.keepItIf(it != path)
   of "nimcache":
     expectArg(conf, switch, arg, pass, info)
+    var arg = arg
+    # refs bug #18674, otherwise `--os:windows` messes up with `--nimcache` set
+    # in config nims files, e.g. via: `import os; switch("nimcache", "/tmp/somedir")`
+    if conf.target.targetOS == osWindows and DirSep == '/': arg = arg.replace('\\', '/')
     conf.nimcacheDir = processPath(conf, arg, info, notRelativeToProj=true)
   of "out", "o":
     expectArg(conf, switch, arg, pass, info)