mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Don't download if already there.
This commit is contained in:
parent
651b9c02ba
commit
bbfde8c44f
1 changed files with 9 additions and 7 deletions
|
@ -58,14 +58,16 @@ class ArtifactFetcher @Inject constructor(@Assisted("url") val url: String,
|
||||||
|
|
||||||
val tmpFile = Paths.get(fileName + ".tmp")
|
val tmpFile = Paths.get(fileName + ".tmp")
|
||||||
val file = Paths.get(fileName)
|
val file = Paths.get(fileName)
|
||||||
with(tmpFile.toFile()) {
|
if (! Files.exists(file)) {
|
||||||
parentFile.mkdirs()
|
with(tmpFile.toFile()) {
|
||||||
urlFactory.create(url).toFile(this)
|
parentFile.mkdirs()
|
||||||
|
urlFactory.create(url).toFile(this)
|
||||||
|
}
|
||||||
|
log(2, "Done downloading, renaming $tmpFile to $file")
|
||||||
|
Files.move(tmpFile, file, StandardCopyOption.REPLACE_EXISTING)
|
||||||
|
log(1, " Downloaded $url")
|
||||||
|
log(2, " to $file")
|
||||||
}
|
}
|
||||||
log(2, "Done downloading, renaming $tmpFile to $file")
|
|
||||||
Files.move(tmpFile, file, StandardCopyOption.REPLACE_EXISTING)
|
|
||||||
log(1, " Downloaded $url")
|
|
||||||
log(2, " to $file")
|
|
||||||
|
|
||||||
val localMd5 = Md5.toMd5(file.toFile())
|
val localMd5 = Md5.toMd5(file.toFile())
|
||||||
if (remoteMd5 != null && remoteMd5 != localMd5) {
|
if (remoteMd5 != null && remoteMd5 != localMd5) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue