From 23211392c0310179bf27612d7a7b58eec106b8ce Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 25 Sep 2019 22:07:39 +0200 Subject: ANDROID: Use external storage enumerator for the root directory --- backends/fs/posix/posix-fs.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'backends/fs/posix') diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 507f075db4..fe72cfec04 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -57,6 +57,9 @@ #include #endif +#if defined(__ANDROID__) && !defined(ANDROIDSDL) +#include "backends/platform/android/jni.h" +#endif bool POSIXFilesystemNode::exists() const { return access(_path.c_str(), F_OK) == 0; @@ -190,6 +193,23 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo } #endif +#if defined(__ANDROID__) && !defined(ANDROIDSDL) + if (_path == "/") { + Common::Array list = JNI::getAllStorageLocations(); + for (Common::Array::const_iterator it = list.begin(), end = list.end(); it != end; ++it) { + POSIXFilesystemNode *entry = new POSIXFilesystemNode(); + + entry->_isDirectory = true; + entry->_isValid = true; + entry->_displayName = *it; + ++it; + entry->_path = *it; + myList.push_back(entry); + } + return true; + } +#endif + DIR *dirp = opendir(_path.c_str()); struct dirent *dp; -- cgit v1.2.3