Browse Source

Fix embedded game.love loading if there's no external storage permission given.

Mainly affect Android M and later devices.
Miku AuahDark 6 years ago
parent
commit
9298bed843
1 changed files with 3 additions and 1 deletions
  1. 3 1
      love/src/main/java/org/love2d/android/GameActivity.java

+ 3 - 1
love/src/main/java/org/love2d/android/GameActivity.java

@@ -36,6 +36,7 @@ public class GameActivity extends SDLActivity {
     public static final int EXTERNAL_STORAGE_REQUEST_CODE = 1;
     public static final int EXTERNAL_STORAGE_REQUEST_CODE = 1;
     private static boolean immersiveActive = false;
     private static boolean immersiveActive = false;
     private static boolean mustCacheArchive = false;
     private static boolean mustCacheArchive = false;
+    private boolean storagePermissionUnnecessary = false;
     public int safeAreaTop = 0;
     public int safeAreaTop = 0;
     public int safeAreaLeft = 0;
     public int safeAreaLeft = 0;
     public int safeAreaBottom = 0;
     public int safeAreaBottom = 0;
@@ -140,6 +141,7 @@ public class GameActivity extends SDLActivity {
                     gamePath = destination_file;
                     gamePath = destination_file;
                 else
                 else
                     gamePath = "game.love";
                     gamePath = "game.love";
+                storagePermissionUnnecessary = true;
             }
             }
         }
         }
 
 
@@ -251,7 +253,7 @@ public class GameActivity extends SDLActivity {
         Log.d("GameActivity", "called getGamePath(), game path = " + gamePath);
         Log.d("GameActivity", "called getGamePath(), game path = " + gamePath);
 
 
         if (gamePath.length() > 0) {
         if (gamePath.length() > 0) {
-            if(self.hasExternalStoragePermission()) {
+            if(self.hasExternalStoragePermission() || self.storagePermissionUnnecessary) {
                 return gamePath;
                 return gamePath;
             } else {
             } else {
                 Log.d("GameActivity", "cannot open game " + gamePath + ": no external storage permission given!");
                 Log.d("GameActivity", "cannot open game " + gamePath + ": no external storage permission given!");