Browse Source

fixed loading of files from file managers

fysx 12 years ago
parent
commit
1703660617
2 changed files with 14 additions and 2 deletions
  1. 8 0
      AndroidManifest.xml
  2. 6 2
      src/org/love2d/android/GameLauncher.java

+ 8 - 0
AndroidManifest.xml

@@ -35,6 +35,14 @@
                 <data android:scheme="content" />
                 <data android:mimeType="application/x-love-game" />
             </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+								<data android:scheme="file" />
+                <data android:mimeType="*/*" />
+                <data android:pathPattern=".*\\.love" />
+                <data android:host="*" />
+            </intent-filter>
         </activity>
     </application>
 

+ 6 - 2
src/org/love2d/android/GameLauncher.java

@@ -17,8 +17,12 @@ public class GameLauncher extends GameActivity {
     protected void onCreate(Bundle bundle) {
         Uri game = this.getIntent().getData();
         if (game != null) {
-        	copyGameToCache (game);
-            Log.d("GameLauncher", "Selected the file: " + getGamePath());
+					if (game.getScheme().equals ("file")) {
+						gamePath = game.getPath();
+					} else {
+	          copyGameToCache (game);
+					}
+          Log.d("GameLauncher", "Selected the file: " + getGamePath());
         }
         super.onCreate(bundle);
     }