From 8d454ed9a7105bf1a4c19c238a0e904f220c1bb5 Mon Sep 17 00:00:00 2001 From: volzhs Date: Fri, 4 Nov 2016 00:41:16 +0900 Subject: Fix Directory.dir_exist/get_current_dir for 'res://' on Android Fix #7014 --- platform/android/dir_access_jandroid.cpp | 4 ++-- platform/android/java/src/org/godotengine/godot/GodotIO.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index 57376f8103..06be1f747d 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -154,7 +154,7 @@ Error DirAccessJAndroid::change_dir(String p_dir){ String DirAccessJAndroid::get_current_dir(){ - return "/"+current_dir; + return "res://"+current_dir; } bool DirAccessJAndroid::file_exists(String p_file){ @@ -268,6 +268,6 @@ DirAccessJAndroid::DirAccessJAndroid() { DirAccessJAndroid::~DirAccessJAndroid() { - list_dir_end();; + list_dir_end(); } #endif diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java index 55e330924a..128a9b2f7b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java @@ -288,6 +288,11 @@ public class GodotIO { try { ad.files = am.list(path); + // no way to find path is directory or file exactly. + // but if ad.files.length==0, then it's an empty directory or file. + if (ad.files.length==0) { + return -1; + } } catch (IOException e) { System.out.printf("Exception on dir_open: %s\n",e); -- cgit v1.2.3