From 2fb98fd36b02bc30a32545e6ef07d979afdb39f9 Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Tue, 18 Jun 2024 15:06:37 +0200 Subject: [PATCH] Fix toString of JarArchive It returns the absolute path of the jar file instead of '/' --- compiler/src/dotty/tools/io/JarArchive.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/io/JarArchive.scala b/compiler/src/dotty/tools/io/JarArchive.scala index 728f89966af0..c396699f93b3 100644 --- a/compiler/src/dotty/tools/io/JarArchive.scala +++ b/compiler/src/dotty/tools/io/JarArchive.scala @@ -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 { @@ -40,6 +42,6 @@ object JarArchive { } } val root = fs.getRootDirectories().iterator.next() - new JarArchive(Directory(root)) + new JarArchive(path, Directory(root)) } }