summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTomohiro <gpuppur@gmail.com>2019-12-02 07:21:36 +0900
committerAndreas Rumpf <rumpf_a@web.de>2019-12-01 23:21:36 +0100
commit378289c6a8600dda2a5bd44cbd5544ce1172cf25 (patch)
tree676add9b316b1f4b19679470fb490ec6105db4dc /compiler
parent6aade97fe82e0308693587aa0d920aeac5a075e1 (diff)
downloadNim-378289c6a8600dda2a5bd44cbd5544ce1172cf25.tar.gz
Fixes #12734 (#12784)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/packagehandling.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim
index ee6af0615..e807ae377 100644
--- a/compiler/packagehandling.nim
+++ b/compiler/packagehandling.nim
@@ -39,8 +39,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
     if parents <= 0: break
 
 proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
+  # Convert `path` so that 2 modules with same name
+  # in different directory get different name and they can be
+  # placed in a directory.
   # foo-#head/../bar becomes @foo-@hhead@s..@sbar
-  result = "@m" & relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@s", "#": "@h", "@": "@@", ":": "@c"})
+  result = "@m" & relativeTo(path, conf.projectPath).string.multiReplace({$os.DirSep: "@s", $os.AltSep: "@s", "#": "@h", "@": "@@", ":": "@c"})
 
 proc demanglePackageName*(path: string): string =
   result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": "", "@c": ":"})