mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-30 02:48:10 +03:00
Android: Skip zip entries with UTFDataFormatException
In most cases it is 配布フリー宣言.txt and can be safely ignored.
This commit is contained in:
@@ -201,9 +201,6 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
handler.sendMessage(handler.obtainMessage(SUCCESS, outDir))
|
||||
} catch (e: InstallFailureException) {
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, e.msgId))
|
||||
} catch (e: UTFDataFormatException) {
|
||||
// Attempted to read Shift_JIS zip in Android < 7
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, R.string.unsupported_zip))
|
||||
} catch (e: IOException) {
|
||||
Log.e("launcher", "Failed to extract ZIP", e)
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, R.string.zip_extraction_error))
|
||||
@@ -249,8 +246,13 @@ private fun forEachZipEntry(input: InputStream, action: (ZipEntry, ZipInputStrea
|
||||
}
|
||||
zip.use {
|
||||
while (true) {
|
||||
val zipEntry = zip.nextEntry ?: break
|
||||
action(zipEntry, zip)
|
||||
try {
|
||||
val zipEntry = zip.nextEntry ?: break
|
||||
action(zipEntry, zip)
|
||||
} catch (e: UTFDataFormatException) {
|
||||
Log.w("forEachZipEntry", "UTFDataFormatException: skipping a zip entry")
|
||||
zip.closeEntry()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user