You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix to problem with updating APK in Google Play keeping old OBB (#17689)
* fix to problem with updating APK in Google Play keeping OBB from previous version
This patch fixes the problem when we are unable to keep OBB from previous version when we are uploading new .apk to Google Play.
It was discussed here:
http://discuss.cocos2d-x.org/t/problem-with-updating-apk-in-google-play-keeping-obb-from-previous-version-because-versioncode-changes/36039
* check for null pointer added
Found an issue which could lead to a crash because of null pointer exception.
If pathToOBB doesn't exist then File.list will return null which will cause fileNames array be null.
Now it is fixed.
// Listing all files inside the folder (pathToOBB) where OBB files are expected to be found.
200
+
String[] fileNames = newFile(pathToOBB).list(newFilenameFilter() { // Using filter to pick up only main OBB file name.
201
+
publicbooleanaccept(Filedir, Stringname) {
202
+
returnname.startsWith("main.") && name.endsWith(".obb"); // It's possible to filter only by extension here to get path to patch OBB file also.
203
+
}
204
+
});
205
+
206
+
StringfullPathToOBB = "";
207
+
if (fileNames != null && fileNames.length > 0) // If there is at least 1 element inside the array with OBB file names, then we may think fileNames[0] will have desired main OBB file name.
208
+
fullPathToOBB = pathToOBB + "/" + fileNames[0]; // Composing full file name for main OBB file.
0 commit comments