File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,23 @@ class ClassPathFactory {
5252
5353 // Internal
5454 protected def classesInPathImpl (path : String , expand : Boolean )(using Context ): List [ClassPath ] =
55- for {
55+ val files = for {
5656 file <- expandPath(path, expand)
5757 dir <- {
5858 def asImage = if (file.endsWith(" .jimage" )) Some (AbstractFile .getFile(file)) else None
5959 Option (AbstractFile .getDirectory(file)).orElse(asImage)
6060 }
6161 }
62- yield newClassPath(dir)
62+ yield dir
63+
64+ val expanded = for file <- files
65+ a <- ClassPath .expandManifestPath(file.absolutePath)
66+ yield
67+ newClassPath(AbstractFile .getFile(a.getPath().toString()))
68+
69+ files.map(newClassPath) ++ expanded
70+
71+ end classesInPathImpl
6372
6473 private def createSourcePath (file : AbstractFile )(using Context ): ClassPath =
6574 if (file.isJarOrZip)
Original file line number Diff line number Diff line change @@ -152,13 +152,18 @@ object ClassPath {
152152
153153 val baseDir = file.parent
154154 new Jar (file).classPathElements map (elem =>
155- specToURL(elem) getOrElse (baseDir / elem).toURL
155+ specToURL(elem, baseDir ) getOrElse (baseDir / elem).toURL
156156 )
157157 }
158158
159- def specToURL (spec : String ): Option [URL ] =
160- try Some (new URI (spec).toURL)
161- catch case _ : MalformedURLException | _ : URISyntaxException => None
159+ def specToURL (spec : String , basedir : Directory ): Option [URL ] =
160+ try
161+ val uri = new URI (spec)
162+ if uri.isAbsolute() then Some (uri.toURL())
163+ else
164+ Some (basedir.resolve(Path (spec)).toURL)
165+ catch
166+ case _ : MalformedURLException | _ : URISyntaxException => None
162167
163168 def manifests : List [java.net.URL ] = {
164169 import scala .jdk .CollectionConverters .EnumerationHasAsScala
You can’t perform that action at this time.
0 commit comments