Skip to content

Commit

Permalink
Fix toString of JarArchive
Browse files Browse the repository at this point in the history
It returns the absolute path of the jar file instead of '/'
  • Loading branch information
adpi2 committed Jun 19, 2024
1 parent 6d7f782 commit 2fb98fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/io/JarArchive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import scala.jdk.CollectionConverters.*
* This class implements an [[AbstractFile]] backed by a jar
* that be can used as the compiler's output directory.
*/
class JarArchive private (root: Directory) extends PlainDirectory(root) {
class JarArchive private (val jarPath: Path, root: Directory) extends PlainDirectory(root) {
def close(): Unit = this.synchronized(jpath.getFileSystem().close())
override def exists: Boolean = jpath.getFileSystem().isOpen() && super.exists
def allFileNames(): Iterator[String] =
java.nio.file.Files.walk(jpath).iterator().asScala.map(_.toString)

override def toString: String = jarPath.toString
}

object JarArchive {
Expand All @@ -40,6 +42,6 @@ object JarArchive {
}
}
val root = fs.getRootDirectories().iterator.next()
new JarArchive(Directory(root))
new JarArchive(path, Directory(root))
}
}

0 comments on commit 2fb98fd

Please sign in to comment.