check rom file is valid or not

This commit is contained in:
Ishan09811 2024-02-10 17:54:02 +05:30 committed by GitHub
parent b256c89e23
commit 9a70060644
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,6 +48,10 @@ public class GamesFragment extends Fragment implements ActivityResultCallback<Ur
public void onActivityResult(Uri result) {
if (result != null) {
String uri = result.toString();
if (!uri.endsWith(".3ds") && !uri.endsWith(".cia")) {
Toast.makeText(getContext(), "Invalid ROM file", Toast.LENGTH_LONG).show();
return;
}
if (GameUtils.findByRomPath(uri) == null) {
if (FileUtils.obtainRealPath(uri) == null) {
Toast.makeText(getContext(), "Invalid file path", Toast.LENGTH_LONG).show();