add asset downloading progress indicator
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
This commit is contained in:
parent
3138da0797
commit
7940f20a13
|
@ -28,14 +28,19 @@ object AssetDownloader {
|
||||||
val objectsPath = path.resolve("objects")
|
val objectsPath = path.resolve("objects")
|
||||||
objectsPath.createDirectories()
|
objectsPath.createDirectories()
|
||||||
val entries = index.getAsJsonObject("objects").entrySet()
|
val entries = index.getAsJsonObject("objects").entrySet()
|
||||||
println("Downloading ${entries.size} assets...")
|
val totalSize = entries.size
|
||||||
entries.forEach {
|
print("Downloading $totalSize assets... ()")
|
||||||
|
System.out.flush()
|
||||||
|
entries.forEachIndexed { i, it ->
|
||||||
val hash = it.value.asJsonObject.get("hash").asString
|
val hash = it.value.asJsonObject.get("hash").asString
|
||||||
/*val size = it.value.asJsonObject.get("size").asInt
|
/*val size = it.value.asJsonObject.get("size").asInt
|
||||||
val name = it.key*/
|
val name = it.key*/
|
||||||
// TODO asset downloading for versions <=1.7 (legacy)
|
// TODO asset downloading for versions <=1.7 (legacy)
|
||||||
|
print("\rDownloading $totalSize assets... ($i/$totalSize): $hash"+" ".repeat(30))
|
||||||
|
System.out.flush()
|
||||||
get(objectsPath, hash)
|
get(objectsPath, hash)
|
||||||
}
|
}
|
||||||
|
println("\rDownloading $totalSize assets... Done!"+" ".repeat(50))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun get(localDir: Path, hash: String) {
|
private fun get(localDir: Path, hash: String) {
|
||||||
|
|
Loading…
Reference in a new issue