From 63c21fcea0d2b7f9a229bac62496a608434513a8 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 30 Dec 2023 17:01:54 +0100 Subject: [PATCH] (Android) Added support for getting directory listings via the SAF --- es-core/src/utils/FileSystemUtil.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 588d5ca77..8b8d8fa90 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -70,6 +70,28 @@ namespace Utils if (!isDirectory(genericPath)) return contentList; +#if defined(__ANDROID__) + if (path.substr(0, FileSystemVariables::sAppDataDirectory.length()) == + FileSystemVariables::sAppDataDirectory) { + Utils::Platform::Android::getDirContent( + path.substr(FileSystemVariables::sAppDataDirectory.length() + 1), + FileSystemVariables::sAppDataDirectory, AndroidVariables::sAppDataPathID, + recursive, contentList); + contentList.sort(); + return contentList; + } + + if (path.substr(0, AndroidVariables::sROMDirectory.length()) == + AndroidVariables::sROMDirectory) { + Utils::Platform::Android::getDirContent( + path.substr(AndroidVariables::sROMDirectory.length()), + AndroidVariables::sROMDirectory, AndroidVariables::sRomPathID, recursive, + contentList); + contentList.sort(); + return contentList; + } +#endif + if (recursive) { #if defined(_WIN64) for (auto& entry : std::filesystem::recursive_directory_iterator(