Fix: smarter file selection for downloaded zipped game files from gb64.com

This commit is contained in:
lantzelot-swe 2021-01-21 23:20:42 +01:00
parent 2fd367d0b3
commit 7a0ca694ea
1 changed files with 11 additions and 1 deletions

View File

@ -860,7 +860,7 @@ public class FileManager
{
fis = new FileInputStream(zipFilePath);
ZipArchiveInputStream zis = new ZipArchiveInputStream(fis);
ZipEntry ze = zis.getNextZipEntry();
ZipEntry ze = getFirstMatchingZipEntry(zis);
if (ze != null)
{
String fileName = ze.getName();
@ -886,5 +886,15 @@ public class FileManager
}
return filePath != null ? filePath.toFile() : null;
}
private static ZipEntry getFirstMatchingZipEntry(ZipArchiveInputStream zis) throws IOException
{
ZipEntry ze = zis.getNextZipEntry();
if (ze != null && ze.getName().endsWith(".NFO"))
{
ze = zis.getNextZipEntry();
}
return ze;
}
}