aboutsummaryrefslogtreecommitdiff
path: root/backends/fs
diff options
context:
space:
mode:
authorEugene Sandulenko2019-09-25 22:07:39 +0200
committerEugene Sandulenko2019-09-27 00:22:20 +0200
commit23211392c0310179bf27612d7a7b58eec106b8ce (patch)
treef7a37958bbfa84620fcc388c997f3c59684ad397 /backends/fs
parent580142c9eaf7fafd4f15827545aaa7f4a1d03322 (diff)
downloadscummvm-rg350-23211392c0310179bf27612d7a7b58eec106b8ce.tar.gz
scummvm-rg350-23211392c0310179bf27612d7a7b58eec106b8ce.tar.bz2
scummvm-rg350-23211392c0310179bf27612d7a7b58eec106b8ce.zip
ANDROID: Use external storage enumerator for the root directory
Diffstat (limited to 'backends/fs')
-rw-r--r--backends/fs/posix/posix-fs.cpp20
1 files changed, 20 insertions, 0 deletions
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 <os2.h>
#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<Common::String> list = JNI::getAllStorageLocations();
+ for (Common::Array<Common::String>::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;