From 378289c6a8600dda2a5bd44cbd5544ce1172cf25 Mon Sep 17 00:00:00 2001 From: Tomohiro Date: Mon, 2 Dec 2019 07:21:36 +0900 Subject: [PATCH] Fixes #12734 (#12784) --- compiler/packagehandling.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim index ee6af06159..e807ae3774 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": ":"})