summary refs log tree commit diff stats
path: root/compiler/packagehandling.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/packagehandling.nim')
-rw-r--r--compiler/packagehandling.nim14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim
index f94c3d72c..d7c6b25ae 100644
--- a/compiler/packagehandling.nim
+++ b/compiler/packagehandling.nim
@@ -29,9 +29,6 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
       for file in walkFiles(d / "*.nimble"):
         result = file.splitFile.name
         break packageSearch
-      for file in walkFiles(d / "*.babel"):
-        result = file.splitFile.name
-        break packageSearch
   # we also store if we didn't find anything:
   when not defined(nimNoNilSeqs):
     if result.isNil: result = ""
@@ -41,10 +38,19 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
     dec parents
     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", "_": "__"})
+
 proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
   let x = getPackageName(conf, path.string)
   if x.len == 0:
     result = path
   else:
     let (p, file, ext) = path.splitFile
-    result = p / RelativeFile((x & '_' & file) & ext)
+    if x == "stdlib":
+      # Hot code reloading now relies on 'stdlib_system' names etc.
+      result = p / RelativeFile((x & '_' & file) & ext)
+    else:
+      result = p / RelativeFile(fakePackageName(conf, path))