You've already forked godot
							
							
				mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 12:00:25 +00:00 
			
		
		
		
	Fix drive selection issue on Android
This commit is contained in:
		@@ -181,7 +181,7 @@
 | 
			
		||||
			<return type="int" />
 | 
			
		||||
			<description>
 | 
			
		||||
				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.
 | 
			
		||||
			</description>
 | 
			
		||||
@@ -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.
 | 
			
		||||
			</description>
 | 
			
		||||
		</method>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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: {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user