mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-29 18:38:13 +03:00
Android: Skip zip entries with UTFDataFormatException
In most cases it is 配布フリー宣言.txt and can be safely ignored.
This commit is contained in:
+1
-1
@@ -57,4 +57,4 @@ Note: This form of ZIP can be used in [Kichikuou on Web](http://kichikuou.github
|
||||
- To uninstall a game, long-tap the title in the game list.
|
||||
|
||||
## Known Issues
|
||||
- Android versions older than 7.0 cannot handle ZIPs containing Shift-JIS file names. This is the case with some ZIPs distributed on [retroc.net](http://retropc.net/alice/). If you get the error "This type of ZIP is not supported.", unzip the ZIP file on your PC and re-archive it with a modern ZIP creation software.
|
||||
- Installation from a ZIP containing multiple games (e.g. DPS series) does not work well.
|
||||
|
||||
@@ -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