mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-10 13:52:38 +02:00
Ported: Fix issue causing the Android Editor port to crash when saving a scene
In addition:
- Disable 'adb devices' query (not supported when running the editor on Android devices
- Add `move_to_trash` implementation for Android devices
- m4gr3d
27b63247fd
This commit is contained in:
parent
65b888f597
commit
7ed3705487
@ -260,6 +260,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ANDROID_ENABLED
|
||||||
// Check for devices updates
|
// Check for devices updates
|
||||||
String adb = get_adb_path();
|
String adb = get_adb_path();
|
||||||
if (FileAccess::exists(adb)) {
|
if (FileAccess::exists(adb)) {
|
||||||
@ -373,6 +374,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {
|
|||||||
|
|
||||||
ea->device_lock.unlock();
|
ea->device_lock.unlock();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint64_t sleep = 300'000;
|
uint64_t sleep = 300'000;
|
||||||
uint64_t wait = 3'000'000;
|
uint64_t wait = 3'000'000;
|
||||||
@ -385,6 +387,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ANDROID_ENABLED
|
||||||
if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) {
|
if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) {
|
||||||
String adb = get_adb_path();
|
String adb = get_adb_path();
|
||||||
if (!FileAccess::exists(adb)) {
|
if (!FileAccess::exists(adb)) {
|
||||||
@ -395,6 +398,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {
|
|||||||
args.push_back("kill-server");
|
args.push_back("kill-server");
|
||||||
OS::get_singleton()->execute(adb, args, true);
|
OS::get_singleton()->execute(adb, args, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
String EditorExportPlatformAndroid::get_project_name(const String &p_name) const {
|
String EditorExportPlatformAndroid::get_project_name(const String &p_name) const {
|
||||||
|
@ -533,6 +533,33 @@ String OS_Android::get_system_dir(SystemDir p_dir, bool p_shared_storage) const
|
|||||||
return pandemonium_io_java->get_system_dir(p_dir, p_shared_storage);
|
return pandemonium_io_java->get_system_dir(p_dir, p_shared_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error OS_Android::move_to_trash(const String &p_path) {
|
||||||
|
DirAccessRef da_ref = DirAccess::create_for_path(p_path);
|
||||||
|
if (!da_ref) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if it's a directory
|
||||||
|
if (da_ref->dir_exists(p_path)) {
|
||||||
|
Error err = da_ref->change_dir(p_path);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
// This is directory, let's erase its contents
|
||||||
|
err = da_ref->erase_contents_recursive();
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
// Remove the top directory
|
||||||
|
return da_ref->remove(p_path);
|
||||||
|
} else if (da_ref->file_exists(p_path)) {
|
||||||
|
// This is a file, let's remove it.
|
||||||
|
return da_ref->remove(p_path);
|
||||||
|
} else {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OS_Android::set_offscreen_gl_available(bool p_available) {
|
void OS_Android::set_offscreen_gl_available(bool p_available) {
|
||||||
secondary_gl_available = p_available;
|
secondary_gl_available = p_available;
|
||||||
}
|
}
|
||||||
|
@ -169,6 +169,8 @@ public:
|
|||||||
|
|
||||||
virtual String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const;
|
virtual String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const;
|
||||||
|
|
||||||
|
virtual Error move_to_trash(const String &p_path);
|
||||||
|
|
||||||
void process_accelerometer(const Vector3 &p_accelerometer);
|
void process_accelerometer(const Vector3 &p_accelerometer);
|
||||||
void process_gravity(const Vector3 &p_gravity);
|
void process_gravity(const Vector3 &p_gravity);
|
||||||
void process_magnetometer(const Vector3 &p_magnetometer);
|
void process_magnetometer(const Vector3 &p_magnetometer);
|
||||||
|
Loading…
Reference in New Issue
Block a user