1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +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

@@ -34,6 +34,7 @@ import android.content.Context
import android.util.Log
import android.util.SparseArray
import org.godotengine.godot.io.StorageScope
import java.io.FileNotFoundException
import java.nio.ByteBuffer
/**
@@ -44,6 +45,7 @@ class FileAccessHandler(val context: Context) {
companion object {
private val TAG = FileAccessHandler::class.java.simpleName
private const val FILE_NOT_FOUND_ERROR_ID = -1
private const val INVALID_FILE_ID = 0
private const val STARTING_FILE_ID = 1
@@ -104,6 +106,8 @@ class FileAccessHandler(val context: Context) {
files.put(++lastFileId, dataAccess)
return lastFileId
} catch (e: FileNotFoundException) {
return FILE_NOT_FOUND_ERROR_ID
} catch (e: Exception) {
Log.w(TAG, "Error while opening $path", e)
return INVALID_FILE_ID