mirror of https://github.com/sbt/sbt.git
Revert "remove a few more java.net.URL"
This reverts commit 861b8aa792.
This commit is contained in:
parent
cb24883c15
commit
a01a2f8bac
|
|
@ -101,7 +101,7 @@ object IfMissing {
|
|||
object ComponentManager {
|
||||
lazy val (version, timestamp) = {
|
||||
val properties = new java.util.Properties
|
||||
val propertiesStream = getClass.getResourceAsStream("/xsbt.version.properties")
|
||||
val propertiesStream = versionResource.openStream
|
||||
try {
|
||||
properties.load(propertiesStream)
|
||||
} finally {
|
||||
|
|
@ -110,4 +110,7 @@ object ComponentManager {
|
|||
(properties.getProperty("version"), properties.getProperty("timestamp"))
|
||||
}
|
||||
lazy val stampedVersion = version + "_" + timestamp
|
||||
|
||||
import java.net.URL
|
||||
private def versionResource: URL = getClass.getResource("/xsbt.version.properties")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,17 +394,17 @@ private[sbt] object ConvertResolver {
|
|||
private[this] val repo = new WarnOnOverwriteFileRepo()
|
||||
private[this] val progress = new RepositoryCopyProgressListener(this);
|
||||
override def getResource(source: String) = {
|
||||
val uri = new URI(source)
|
||||
if (uri.getScheme == IO.FileScheme)
|
||||
new FileResource(repo, IO.toFile(uri))
|
||||
val url = new URI(source).toURL
|
||||
if (url.getProtocol == IO.FileScheme)
|
||||
new FileResource(repo, IO.toFile(url))
|
||||
else
|
||||
super.getResource(source)
|
||||
}
|
||||
|
||||
override def put(source: File, destination: String, overwrite: Boolean): Unit = {
|
||||
val uri = new URI(destination)
|
||||
val url = new URI(destination).toURL
|
||||
try {
|
||||
if (uri.getScheme != IO.FileScheme) super.put(source, destination, overwrite)
|
||||
if (url.getProtocol != IO.FileScheme) super.put(source, destination, overwrite)
|
||||
else {
|
||||
// Here we duplicate the put method for files so we don't just bail on trying ot use Http handler
|
||||
val resource = getResource(destination)
|
||||
|
|
@ -417,7 +417,7 @@ private[sbt] object ConvertResolver {
|
|||
if (totalLength > 0) {
|
||||
progress.setTotalLength(totalLength);
|
||||
}
|
||||
FileUtil.copy(source, new java.io.File(uri), progress, overwrite)
|
||||
FileUtil.copy(source, new java.io.File(url.toURI), progress, overwrite)
|
||||
()
|
||||
} catch {
|
||||
case ex: IOException =>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ private[sbt] class FakeResolver(private var name: String, cacheDir: File, module
|
|||
): ArtifactDownloadReport = {
|
||||
|
||||
val report = new ArtifactDownloadReport(artifact.getArtifact)
|
||||
val path = new URI(artifact.getLocation).getPath
|
||||
val path = new URI(artifact.getLocation).toURL.toURI.getPath
|
||||
val localFile = new File(path)
|
||||
|
||||
if (path.nonEmpty && localFile.exists) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue