summaryrefslogtreecommitdiffstats
path: root/platform/android/java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/src/com/android/godot/GodotIO.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/platform/android/java/src/com/android/godot/GodotIO.java b/platform/android/java/src/com/android/godot/GodotIO.java
index b793b8850a..addceb1528 100644
--- a/platform/android/java/src/com/android/godot/GodotIO.java
+++ b/platform/android/java/src/com/android/godot/GodotIO.java
@@ -271,6 +271,7 @@ public class GodotIO {
public String[] files;
public int current;
+ public String path;
}
public int last_dir_id=1;
@@ -281,6 +282,7 @@ public class GodotIO {
AssetDir ad = new AssetDir();
ad.current=0;
+ ad.path=path;
try {
ad.files = am.list(path);
@@ -290,6 +292,7 @@ public class GodotIO {
return -1;
}
+ //System.out.printf("Opened dir: %s\n",path);
++last_dir_id;
dirs.put(last_dir_id,ad);
@@ -297,6 +300,32 @@ public class GodotIO {
}
+ public boolean dir_is_dir(int id) {
+ if (!dirs.containsKey(id)) {
+ System.out.printf("dir_next: invalid dir id: %d\n",id);
+ return false;
+ }
+ AssetDir ad = dirs.get(id);
+ //System.out.printf("go next: %d,%d\n",ad.current,ad.files.length);
+ int idx = ad.current;
+ if (idx>0)
+ idx--;
+
+ if (idx>=ad.files.length)
+ return false;
+ String fname = ad.files[idx];
+
+ try {
+ if (ad.path.equals(""))
+ am.open(fname);
+ else
+ am.open(ad.path+"/"+fname);
+ return false;
+ } catch (Exception e) {
+ return true;
+ }
+ }
+
public String dir_next(int id) {
if (!dirs.containsKey(id)) {
@@ -305,8 +334,12 @@ public class GodotIO {
}
AssetDir ad = dirs.get(id);
- if (ad.current>=ad.files.length)
+ //System.out.printf("go next: %d,%d\n",ad.current,ad.files.length);
+
+ if (ad.current>=ad.files.length) {
+ ad.current++;
return "";
+ }
String r = ad.files[ad.current];
ad.current++;
return r;