citra_android: fix select root as citra directory cause crash (#6400)
This commit is contained in:
parent
31cd8120b6
commit
7d64c654cc
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue