summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2014-11-10 14:43:39 +0100
committerHeather Miller <heather.miller@epfl.ch>2014-11-10 14:43:39 +0100
commit24a2ef9728c403b81ffb36f2da241cff35defd78 (patch)
tree703f3c14b1aca411a235b8e6507ecd84b31b5101 /src/reflect
parent9e56c7a6fe73bce5962a3b121615c6a5bc1023d2 (diff)
downloadscala-24a2ef9728c403b81ffb36f2da241cff35defd78.tar.gz
scala-24a2ef9728c403b81ffb36f2da241cff35defd78.tar.bz2
scala-24a2ef9728c403b81ffb36f2da241cff35defd78.zip
SI-6502 Refactorings suggested by review
- Moves mergeUrlsIntoClassPath from Global into ClassPath - Revises and documents AbstractFile.getURL
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/io/AbstractFile.scala16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/io/AbstractFile.scala b/src/reflect/scala/reflect/io/AbstractFile.scala
index ac1159b2ac..bcefcc471f 100644
--- a/src/reflect/scala/reflect/io/AbstractFile.scala
+++ b/src/reflect/scala/reflect/io/AbstractFile.scala
@@ -48,14 +48,16 @@ object AbstractFile {
else null
/**
- * If the specified URL exists and is a readable zip or jar archive,
- * returns an abstract directory backed by it. Otherwise, returns
- * `null`.
+ * If the specified URL exists and is a regular file or a directory, returns an
+ * abstract regular file or an abstract directory, respectively, backed by it.
+ * Otherwise, returns `null`.
*/
- def getURL(url: URL): AbstractFile = {
- if (url == null || !Path.isExtensionJarOrZip(url.getPath)) null
- else ZipArchive fromURL url
- }
+ def getURL(url: URL): AbstractFile =
+ if (url.getProtocol == "file") {
+ val f = new java.io.File(url.getPath)
+ if (f.isDirectory) getDirectory(f)
+ else getFile(f)
+ } else null
def getResources(url: URL): AbstractFile = ZipArchive fromManifestURL url
}