Skip to content

Commit 943cf0d

Browse files
committed
Fix traversing jar files with tasty inspector
1 parent b5417d1 commit 943cf0d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package fromtasty
44

55
import io.{JarArchive, AbstractFile, Path}
66
import core.Contexts._
7+
import java.io.File
78

89
class TASTYRun(comp: Compiler, ictx: Context) extends Run(comp, ictx) {
910
override def compile(files: List[AbstractFile]): Unit = {
@@ -18,8 +19,9 @@ class TASTYRun(comp: Compiler, ictx: Context) extends Run(comp, ictx) {
1819
file.extension match
1920
case "jar" =>
2021
JarArchive.open(Path(file.path), create = false).allFileNames()
22+
.map(_.stripPrefix(File.separator)) // change paths from absolute to relative
2123
.filter(e => Path.extension(e) == "tasty" && !fromTastyIgnoreList(e))
22-
.map(e => e.stripSuffix(".tasty").replace("/", "."))
24+
.map(e => e.stripSuffix(".tasty").replace(File.separator, "."))
2325
.toList
2426
case "tasty" => TastyFileUtil.getClassName(file)
2527
case _ =>

0 commit comments

Comments
 (0)