1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Don't download if already there.

This commit is contained in:
Cedric Beust 2015-11-29 09:59:12 -08:00
parent 651b9c02ba
commit bbfde8c44f

View file

@ -58,6 +58,7 @@ class ArtifactFetcher @Inject constructor(@Assisted("url") val url: String,
val tmpFile = Paths.get(fileName + ".tmp")
val file = Paths.get(fileName)
if (! Files.exists(file)) {
with(tmpFile.toFile()) {
parentFile.mkdirs()
urlFactory.create(url).toFile(this)
@ -66,6 +67,7 @@ class ArtifactFetcher @Inject constructor(@Assisted("url") val url: String,
Files.move(tmpFile, file, StandardCopyOption.REPLACE_EXISTING)
log(1, " Downloaded $url")
log(2, " to $file")
}
val localMd5 = Md5.toMd5(file.toFile())
if (remoteMd5 != null && remoteMd5 != localMd5) {