citra-emu
/
citra
Archived
1
0
Fork 0

citra_android: fix select root as citra directory cause crash (#6400)

This commit is contained in:
hank121314 2023-04-06 00:50:53 +08:00 committed by GitHub
parent 31cd8120b6
commit 7d64c654cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -425,9 +425,12 @@ public class FileUtil {
} }
public static String getFilenameWithExtensions(Uri uri) { public static String getFilenameWithExtensions(Uri uri) {
final String path = uri.getPath(); String path = uri.getPath();
final int index = path.lastIndexOf('/'); final int slashIndex = path.lastIndexOf('/');
return path.substring(index + 1); path = path.substring(slashIndex + 1);
// On Android versions below 10, it is possible to select the storage root, which might result in filenames with a colon.
final int colonIndex = path.indexOf(':');
return path.substring(colonIndex + 1);
} }
public static double getFreeSpace(Context context, Uri uri) { public static double getFreeSpace(Context context, Uri uri) {