diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-20 00:42:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-20 00:42:51 +0100 |
commit | ecf80fbbbadaa782cbe81a6562916331c6762970 (patch) | |
tree | 7a949f6a95f36303a2f2d193aeabd6486e13f4a1 /platform/android | |
parent | bc26a5bd3a51b11bab63112275e7045c63a0ffc4 (diff) | |
parent | 6e3f2f44af808e9f4255c2462e16beee844c0df7 (diff) |
Merge pull request #12988 from akien-mga/xdg-home-paths
Add support for XDG Base Directory spec
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/export/export.cpp | 4 | ||||
-rw-r--r-- | platform/android/java_glue.cpp | 4 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 11 | ||||
-rw-r--r-- | platform/android/os_android.h | 8 |
4 files changed, 13 insertions, 14 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 9945dc599b..c15aa2bd71 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1067,7 +1067,7 @@ public: if (use_reverse) p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST; - String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk"; + String export_to = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport.apk"); Error err = export_project(p_preset, true, export_to, p_debug_flags); if (err) { device_lock->unlock(); @@ -1292,7 +1292,7 @@ public: zlib_filefunc_def io2 = io; FileAccess *dst_f = NULL; io2.opaque = &dst_f; - String unaligned_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport-unaligned.apk"; + String unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned.apk"); zipFile unaligned_apk = zipOpen2(unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2); bool export_x86 = p_preset->get("architecture/x86"); diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 90144d9b4d..40dfe6d909 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -647,7 +647,7 @@ static int _open_uri(const String &p_uri) { return env->CallIntMethod(godot_io, _openURI, jStr); } -static String _get_data_dir() { +static String _get_user_data_dir() { JNIEnv *env = ThreadAndroid::get_env(); jstring s = (jstring)env->CallObjectMethod(godot_io, _getDataDir); @@ -825,7 +825,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en AudioDriverAndroid::setup(gob); } - os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion); + os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 2578bd6d96..d5ccf76631 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -612,13 +612,13 @@ void OS_Android::set_need_reload_hooks(bool p_needs_them) { use_reload_hooks = p_needs_them; } -String OS_Android::get_data_dir() const { +String OS_Android::get_user_data_dir() const { if (data_dir_cache != String()) return data_dir_cache; - if (get_data_dir_func) { - String data_dir = get_data_dir_func(); + if (get_user_data_dir_func) { + String data_dir = get_user_data_dir_func(); //store current dir char real_current_dir_name[2048]; @@ -641,7 +641,6 @@ String OS_Android::get_data_dir() const { } return "."; - //return Engine::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); } void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) { @@ -709,7 +708,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) { return p_feature == "mobile" || p_feature == "etc" || p_feature == "etc2"; //TODO support etc2 only if GLES3 driver is selected } -OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { +OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { use_apk_expansion = p_use_apk_expansion; default_videomode.width = 800; @@ -725,7 +724,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI use_gl2 = false; open_uri_func = p_open_uri_func; - get_data_dir_func = p_get_data_dir_func; + get_user_data_dir_func = p_get_user_data_dir_func; get_locale_func = p_get_locale_func; get_model_func = p_get_model_func; get_screen_dpi_func = p_get_screen_dpi_func; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 750afa7a14..d25f60d540 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -48,7 +48,7 @@ typedef void (*GFXInitFunc)(void *ud, bool gl2); typedef int (*OpenURIFunc)(const String &); -typedef String (*GetDataDirFunc)(); +typedef String (*GetUserDataDirFunc)(); typedef String (*GetLocaleFunc)(); typedef String (*GetModelFunc)(); typedef int (*GetScreenDPIFunc)(); @@ -116,7 +116,7 @@ private: MainLoop *main_loop; OpenURIFunc open_uri_func; - GetDataDirFunc get_data_dir_func; + GetUserDataDirFunc get_user_data_dir_func; GetLocaleFunc get_locale_func; GetModelFunc get_model_func; GetScreenDPIFunc get_screen_dpi_func; @@ -208,7 +208,7 @@ public: virtual void set_screen_orientation(ScreenOrientation p_orientation); virtual Error shell_open(String p_uri); - virtual String get_data_dir() const; + virtual String get_user_data_dir() const; virtual String get_resource_dir() const; virtual String get_locale() const; virtual String get_model_name() const; @@ -237,7 +237,7 @@ public: void joy_connection_changed(int p_device, bool p_connected, String p_name); virtual bool _check_internal_feature_support(const String &p_feature); - OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); + OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); ~OS_Android(); }; |