diff --git a/doc/classes/DirAccess.xml b/doc/classes/DirAccess.xml index 9d15a04f67..b21b507a93 100644 --- a/doc/classes/DirAccess.xml +++ b/doc/classes/DirAccess.xml @@ -181,7 +181,7 @@ On Windows, returns the number of drives (partitions) mounted on the current filesystem. - On macOS, returns the number of mounted volumes. + On macOS and Android, returns the number of mounted volumes. On Linux, returns the number of mounted volumes and GTK 3 bookmarks. On other platforms, the method returns 0. @@ -193,6 +193,7 @@ On Windows, returns the name of the drive (partition) passed as an argument (e.g. [code]C:[/code]). On macOS, returns the path to the mounted volume passed as an argument. On Linux, returns the path to the mounted volume or GTK 3 bookmark passed as an argument. + On Android (API level 30+), returns the path to the mounted volume as an argument. On other platforms, or if the requested drive does not exist, the method returns an empty String. diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt index 2d102deb91..7d5ae7d6ac 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt @@ -159,7 +159,11 @@ internal class FilesystemDirectoryAccess(private val context: Context, private v } val storageVolume = storageManager.storageVolumes[drive] - return storageVolume.getDescription(context) + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + storageVolume.directory?.absolutePath ?: "" + } else { + "" + } } override fun makeDir(dir: String): Boolean { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 3756225c8b..4bb4b6d95f 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -1362,7 +1362,7 @@ void FileDialog::set_access(Access p_access) { case ACCESS_FILESYSTEM: { dir_access = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); #ifdef ANDROID_ENABLED - set_root_subfolder(OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DESKTOP)); + set_current_dir(OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DESKTOP)); #endif } break; case ACCESS_RESOURCES: {