Fix regex

This commit is contained in:
PabloG02 2023-04-10 14:46:55 +02:00 committed by Billy Laws
parent f85ecc23be
commit dae5469a61
1 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,7 @@ class AppDialog : BottomSheetDialogFragment() {
// A TitleID must be the first folder name inside the zip in order to be considered valid. // A TitleID must be the first folder name inside the zip in order to be considered valid.
if (inputZip != null) { if (inputZip != null) {
ZipInputStream(BufferedInputStream(inputZip)).use { zis -> ZipInputStream(BufferedInputStream(inputZip)).use { zis ->
validZip = Regex("^0100[0-9A-Fa-f]{12}/\$").matches(zis.nextEntry.name) validZip = Regex("^0100[0-9A-Fa-f]{12}/").containsMatchIn(zis.nextEntry.name)
} }
} }
inputZip = requireContext().contentResolver.openInputStream(uri) inputZip = requireContext().contentResolver.openInputStream(uri)
@ -85,6 +85,7 @@ class AppDialog : BottomSheetDialogFragment() {
val isSaveFileOfThisGame = File("$savesFolderRoot${item.titleId}").exists() val isSaveFileOfThisGame = File("$savesFolderRoot${item.titleId}").exists()
binding.deleteSave.isEnabled = isSaveFileOfThisGame binding.deleteSave.isEnabled = isSaveFileOfThisGame
binding.exportSave.isEnabled = isSaveFileOfThisGame binding.exportSave.isEnabled = isSaveFileOfThisGame
Snackbar.make(binding.root, "The save file was imported successfully", Snackbar.LENGTH_LONG).show()
} }
} }
} else { } else {