mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-27 13:35:06 -06:00
android: Fix long-press menu for games in app dir displaying no file error
This commit is contained in:
parent
30779d35cd
commit
0407568006
@ -256,6 +256,8 @@ object NativeLibrary {
|
||||
return uninstallTitle(titleId, mediaType.value)
|
||||
}
|
||||
|
||||
external fun nativeFileExists(path: String): Boolean
|
||||
|
||||
private var coreErrorAlertResult = false
|
||||
private val coreErrorAlertLock = Object()
|
||||
|
||||
|
||||
@ -54,8 +54,10 @@ import org.citra.citra_emu.databinding.DialogShortcutBinding
|
||||
import org.citra.citra_emu.features.cheats.ui.CheatsFragmentDirections
|
||||
import org.citra.citra_emu.fragments.IndeterminateProgressDialogFragment
|
||||
import org.citra.citra_emu.model.Game
|
||||
import org.citra.citra_emu.utils.BuildUtil
|
||||
import org.citra.citra_emu.utils.FileUtil
|
||||
import org.citra.citra_emu.utils.GameIconUtils
|
||||
import org.citra.citra_emu.utils.Log
|
||||
import org.citra.citra_emu.viewmodel.GamesViewModel
|
||||
|
||||
class GameAdapter(
|
||||
@ -153,12 +155,21 @@ class GameAdapter(
|
||||
if (holder.game.isInstalled) {
|
||||
return true
|
||||
}
|
||||
|
||||
val gameExists = DocumentFile.fromSingleUri(
|
||||
CitraApplication.appContext,
|
||||
Uri.parse(holder.game.path)
|
||||
)?.exists() == true
|
||||
val path = holder.game.path
|
||||
val pathUri = path.toUri()
|
||||
var gameExists: Boolean
|
||||
if (BuildUtil.isGooglePlayBuild || FileUtil.isNativePath(path)) {
|
||||
gameExists =
|
||||
DocumentFile.fromSingleUri(
|
||||
CitraApplication.appContext,
|
||||
pathUri
|
||||
)?.exists() == true
|
||||
} else {
|
||||
val nativePath = NativeLibrary.getNativePath(pathUri)
|
||||
gameExists = NativeLibrary.nativeFileExists(nativePath)
|
||||
}
|
||||
return if (!gameExists) {
|
||||
Log.error("[GameAdapter] ROM file does not exist: $path")
|
||||
Toast.makeText(
|
||||
CitraApplication.appContext,
|
||||
R.string.loader_error_file_not_found,
|
||||
|
||||
@ -1124,4 +1124,10 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_uninstallTitle(JNIEnv* env, job
|
||||
return true;
|
||||
}
|
||||
|
||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_nativeFileExists(JNIEnv* env, jobject obj,
|
||||
jstring j_path) {
|
||||
const auto path = GetJString(env, j_path);
|
||||
return FileUtil::Exists(path);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user