@@ -429,29 +429,31 @@ fun unpackGame(version: GameVersion) {
429429 Gdx .files.local(" versions" ).mkdirs()
430430 }
431431
432- ZipFile (Gdx .files.local(" temp/${version.id} " ).file()).use { zip ->
433- if (! Gdx .files.local(" versions/${version.id} " ).exists()) {
434- Gdx .files.local(" versions/${version.id} " ).mkdirs()
432+ val exec = Runtime .getRuntime()
433+ .exec(arrayOf(" powershell" , " Expand-Archive" , " -Path" , " temp/${version.id} " , " -DestinationPath" , " versions/${version.id} " ))
434+
435+ val waitFor =
436+ exec.waitFor()
437+
438+ if (waitFor != 0 ) {
439+ for (i in 0 until exec.errorStream.available()) {
440+ print (exec.errorStream.read().toChar())
435441 }
436- zip.entries().asSequence().forEach { entry ->
437- zip.getInputStream(entry).use { inputStream ->
438- if (version.id in arrayOf(" 0.0.0-indev" , " 0.0.1-indev" ) || version is ChannelVersion ) {
439- if (! Gdx .files.local(" versions/${version.id} /${entry.name.substringAfter(' /' )} " ).parent()
440- .exists()
441- ) {
442- Gdx .files.local(" versions/${version.id} /${entry.name.substringAfter(' /' )} " ).parent().mkdirs()
443- }
444- Gdx .files.local(" versions/${version.id} /${entry.name.substringAfter(' /' )} " )
445- .write(inputStream, false )
446- } else {
447- if (! Gdx .files.local(" temp/${version.id} -extract" ).exists()) {
448- Gdx .files.local(" temp/${version.id} -extract" ).mkdirs()
449- }
450- Gdx .files.local(" temp/${version.id} -extract/${entry.name.substringAfter(' /' )} " ).parent().mkdirs()
451- Gdx .files.local(" temp/${version.id} -extract/${entry.name.substringAfter(' /' )} " )
452- .write(inputStream, false )
453- }
442+ println (" Failed to unpack ${version.id} " )
443+ }
444+
445+ if (version.id in arrayOf(" 0.0.0-indev" , " 0.0.1-indev" ) || version is ChannelVersion ) {
446+ val exec2 = Runtime .getRuntime()
447+ .exec(arrayOf(" powershell" , " Move-Item" , " -Path" , " versions/${version.id} /*" , " -Destination" , " versions/${version.id} " ))
448+
449+ val waitFor2 =
450+ exec2.waitFor()
451+
452+ if (waitFor2 != 0 ) {
453+ for (i in 0 until exec2.errorStream.available()) {
454+ print (exec2.errorStream.read().toChar())
454455 }
456+ println (" Failed to move ${version.id} " )
455457 }
456458 }
457459 } else if (System .getProperty(" os.name" ).startsWith(" Linux" )) {
0 commit comments