summaryrefslogtreecommitdiff
path: root/platform/android/os_android.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/os_android.cpp')
-rw-r--r--platform/android/os_android.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 4e6dfb2db2..3c2b4c22e7 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -614,6 +614,11 @@ void OS_Android::process_magnetometer(const Vector3& p_magnetometer) {
input->set_magnetometer(p_magnetometer);
}
+void OS_Android::process_gyroscope(const Vector3& p_gyroscope) {
+
+ input->set_gyroscope(p_gyroscope);
+}
+
bool OS_Android::has_touchscreen_ui_hint() const {
return true;
@@ -708,8 +713,33 @@ void OS_Android::set_need_reload_hooks(bool p_needs_them) {
String OS_Android::get_data_dir() const {
- if (get_data_dir_func)
- return get_data_dir_func();
+ if (data_dir_cache!=String())
+ return data_dir_cache;
+
+ if (get_data_dir_func) {
+ String data_dir=get_data_dir_func();
+
+ //store current dir
+ char real_current_dir_name[2048];
+ getcwd(real_current_dir_name,2048);
+
+ //go to data dir
+ chdir(data_dir.utf8().get_data());
+
+ //get actual data dir, so we resolve potential symlink (Android 6.0+ seems to use symlink)
+ char data_current_dir_name[2048];
+ getcwd(data_current_dir_name,2048);
+
+ //cache by parsing utf8
+ data_dir_cache.parse_utf8(data_current_dir_name);
+
+ //restore original dir so we don't mess things up
+ chdir(real_current_dir_name);
+
+ return data_dir_cache;
+ }
+
+
return ".";
//return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
};