Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/scala/viper/silver/utility/Paths.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,28 @@ object Paths {

fs.getPath(entryName)

case "resource" =>
val uriStr = uri.toString
assert(uriStr.startsWith("resource:/"), "Resource URL should start with \"resource:/\"")
val entryName = uriStr.substring(9)
val fileURI = URI.create("resource:/")

var fs: FileSystem = null

try {
fs = FileSystems.newFileSystem(fileURI, Map[String, Object]().asJava)
openFileSystems = fs +: openFileSystems
} catch {
case _: java.nio.file.FileSystemAlreadyExistsException =>
fs = FileSystems.getFileSystem(fileURI)
assert(fs.isOpen, "The reused file system is expected to still be open")
} finally {
assert(fs != null, s"Could not get hold of a file system for $fileURI (from $uriStr)")
}

fs.getPath(entryName)


case other => sys.error(s"Resource $uri of scheme $other is not supported.")
}
}
Expand Down