parent
6aade97fe8
commit
378289c6a8
1 changed files with 4 additions and 1 deletions
|
|
@ -39,8 +39,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
||||||
if parents <= 0: break
|
if parents <= 0: break
|
||||||
|
|
||||||
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
|
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
|
# 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 =
|
proc demanglePackageName*(path: string): string =
|
||||||
result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": "", "@c": ":"})
|
result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": "", "@c": ":"})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue