1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

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
This commit is contained in:
Fredia Huya-Kouadio
2022-07-05 01:50:26 -07:00
parent 0cc154b120
commit 27b63247fd
5 changed files with 45 additions and 1 deletions

View File

@@ -538,6 +538,33 @@ String OS_Android::get_system_dir(SystemDir p_dir, bool p_shared_storage) const
return godot_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) {
secondary_gl_available = p_available;
}