diff --git a/Common/System/Request.cpp b/Common/System/Request.cpp index 2ad6f27e10..f1e0d43edf 100644 --- a/Common/System/Request.cpp +++ b/Common/System/Request.cpp @@ -134,6 +134,7 @@ void System_CreateGameShortcut(const Path &path, const std::string &title) { g_requestManager.MakeSystemRequest(SystemRequestType::CREATE_GAME_SHORTCUT, NO_REQUESTER_TOKEN, nullptr, nullptr, path.ToString(), title, 0); } +// Also acts as just show folder, if you pass in a folder. void System_ShowFileInFolder(const Path &path) { g_requestManager.MakeSystemRequest(SystemRequestType::SHOW_FILE_IN_FOLDER, NO_REQUESTER_TOKEN, nullptr, nullptr, path.ToString(), "", 0); } diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 08858ca83d..9fc3faf0f1 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -486,7 +486,7 @@ bool System_GetPropertyBool(SystemProperty prop) { case SYSPROP_HAS_TEXT_INPUT_DIALOG: return true; case SYSPROP_HAS_OPEN_DIRECTORY: - return false; + return false; // We have this implemented but it may or may not work depending on if a file explorer is installed. case SYSPROP_HAS_ADDITIONAL_STORAGE: return !g_additionalStorageDirs.empty(); case SYSPROP_HAS_BACK_BUTTON: @@ -1144,6 +1144,9 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string case SystemRequestType::NOTIFY_UI_STATE: PushCommand("uistate", param1); return true; + case SystemRequestType::SHOW_FILE_IN_FOLDER: + PushCommand("show_folder", param1); + return true; default: return false; } diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 5b6b8fe2ce..22662e20c6 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -1633,8 +1633,25 @@ public abstract class NativeActivity extends Activity { throw new Exception(); } catch (Exception e) { NativeApp.reportException(e, params); - - + } + } else if (command.equals("show_folder")) { + try { + Uri selectedUri = Uri.parse(params); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(selectedUri, "resource/folder"); + if (intent.resolveActivityInfo(getPackageManager(), 0) != null) { + startActivity(intent); + Log.i(TAG, "Started activity for " + params); + return true; + } else { + Log.w(TAG, "No file explorer installed"); + // if you reach this place, it means there is no any file + // explorer app installed on your device + return false; + } + } catch (Exception e) { + NativeApp.reportException(e, params); + return false; } } return false;