Start experimenting with DocumentsContract (the thing DocumentFile wraps)

wip

Some progress towards making the file browser work with DOCUMENT_TREE

More directory browsing progress

More Scoped Storage hackery. Can now browse to a folder and use PPSSPP's game browser to load ISOs from it.

Remove the defunct fdopendir approach. Buildfixes.
This commit is contained in:
Henrik Rydgård committed 2021-06-07 00:24:51 +02:00
1 parent 5030f1f719
commit 87a25fd230
13 files changed
+152 -55

No files matched your search

+1 -28
View File
@@ -1206,34 +1206,7 @@ void MainScreen::sendMessage(const char *message, const char *value) {
LaunchFile(screenManager(), Path(std::string(value)));
}
if (!strcmp(message, "browse_folderSelect")) {
std::string filename;
#if PPSSPP_PLATFORM(ANDROID)
// Hacky way to get a normal path from a Android Storage Framework path.
// Is not gonna work forever, but ship-hack for 1.11.
std::string url = value;
const char *prefix = "content://com.android.externalstorage.documents/tree/";
const char *primaryPrefix = "/storage/primary/";
if (startsWith(url, prefix)) {
url = UriDecode(url.substr(strlen(prefix)));
size_t colonPos = url.find(":");
if (colonPos != std::string::npos) {
url[colonPos] = '/';
}
url = "/storage/" + url;
if (startsWith(url, primaryPrefix)) {
url = g_Config.memStickDirectory.ToString() + url.substr(strlen(primaryPrefix));
}
INFO_LOG(SYSTEM, "Translated '%s' into '%s'", value, url.c_str());
} else {
// It's not gonna work.
// TODO: Show an error message?
INFO_LOG(SYSTEM, "Failed to parse content string: '%s'", value);
return;
}
filename = url;
#else
filename = value;
#endif
std::string filename = value;
INFO_LOG(SYSTEM, "Got folder: '%s'", filename.c_str());
int tab = tabHolder_->GetCurrentTab();
// Don't allow browsing in the other tabs (I don't think it's possible to reach the option though)