Browse Source

Merge pull request #3101 from IvanSavenko/fix_android_data_import

Fix data import on Android
Ivan Savenko 2 years ago
parent
commit
18b8971d6f

+ 3 - 1
android/vcmi-app/src/main/java/eu/vcmi/vcmi/Storage.java

@@ -22,7 +22,9 @@ public class Storage
     public static boolean testH3DataFolder(final File baseDir)
     {
         final File testH3Data = new File(baseDir, "Data");
-        return testH3Data.exists();
+        final File testH3data = new File(baseDir, "data");
+        final File testH3DATA = new File(baseDir, "DATA");
+        return testH3Data.exists() || testH3data.exists() || testH3DATA.exists();
     }
 
     public static String getH3DataFolder(Context context){

+ 14 - 2
android/vcmi-app/src/main/java/eu/vcmi/vcmi/settings/CopyDataController.java

@@ -127,9 +127,21 @@ public class CopyDataController extends LauncherSettingController<Void, Void>
 
             for (DocumentFile child : sourceDir.listFiles())
             {
-                if (allowed != null && !allowed.contains(child.getName()))
+                if (allowed != null)
                 {
-                    continue;
+                    boolean fileAllowed = false;
+                    
+                    for (String str : allowed)
+                    {
+                        if (str.equalsIgnoreCase(child.getName()))
+                        {
+                            fileAllowed = true;
+                            break;
+                        }
+                    }
+                    
+                    if (!fileAllowed)
+                        continue;
                 }
 
                 File exported = new File(targetDir, child.getName());