diff options
Diffstat (limited to 'compiler/packagehandling.nim')
-rw-r--r-- | compiler/packagehandling.nim | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim index b9db61b4d..561d6dfc4 100644 --- a/compiler/packagehandling.nim +++ b/compiler/packagehandling.nim @@ -39,13 +39,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string = if parents <= 0: break proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string = - # foo/../bar becomes foo7_7bar - result = relativeTo(path, conf.projectPath, '/').string.multiReplace( - {"/": "7", "..": "_", "7": "77", "_": "__", ":": "8", "8": "88"}) + # foo-#head/../bar becomes @foo-@hhead@s..@sbar + result = "@" & relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@s", "#": "@h", "@": "@@"}) proc demanglePackageName*(path: string): string = - result = path.multiReplace( - {"88": "8", "8": ":", "77": "7", "__": "_", "_7": "../", "7": "/"}) + result = path[1 .. ^1].multiReplace({"@@": "@", "@h": "#", "@s": "/"}) proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile = let x = getPackageName(conf, path.string) |