From 75be1e999d55551db23919e2d661772a45615d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 8 Jan 2021 12:11:23 +0100 Subject: [PATCH] Try another method for getting SD card storage paths (env vars). See #13827 --- .../src/org/ppsspp/ppsspp/NativeActivity.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 7df87de1193e..e4632578c7cb 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -266,7 +266,18 @@ private static ArrayList getSdCardPaths(final Context context) { } } - // TODO: On older devices, try System.getenv(“EXTERNAL_SDCARD_STORAGE”) + if (list == null) { + String[] varNames = { "EXTERNAL_SDCARD_STORAGE", "SECONDARY_STORAGE" }; + for (String var : varNames) { + Log.i(TAG, "getSdCardPaths: Checking env " + var); + String secStore = System.getenv("SECONDARY_STORAGE"); + if (secStore != null && secStore.length() > 0) { + list = new ArrayList(); + list.add(secStore); + break; + } + } + } if (list == null) { return new ArrayList(); @@ -275,9 +286,6 @@ private static ArrayList getSdCardPaths(final Context context) { } } - /** - * returns a list of all available sd cards paths, or null if not found. - */ @TargetApi(Build.VERSION_CODES.KITKAT) private static ArrayList getSdCardPaths19(final Context context) {