summaryrefslogtreecommitdiffstats
path: root/src/common/fs
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2023-06-16 02:20:56 +0200
committerbunnei <bunneidev@gmail.com>2023-06-16 02:20:56 +0200
commit5384fa499869dbf655c6838eb6660138cf80cccc (patch)
tree424fc0fdfe89c506cd00607fa920915b58119d2d /src/common/fs
parentMerge pull request #10639 from 8bitDream/pictureinpicture (diff)
downloadyuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar.gz
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar.bz2
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar.lz
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar.xz
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.tar.zst
yuzu-5384fa499869dbf655c6838eb6660138cf80cccc.zip
Diffstat (limited to 'src/common/fs')
-rw-r--r--src/common/fs/fs.cpp27
-rw-r--r--src/common/fs/fs_android.h5
2 files changed, 31 insertions, 1 deletions
diff --git a/src/common/fs/fs.cpp b/src/common/fs/fs.cpp
index e1716c62d..6d66c926d 100644
--- a/src/common/fs/fs.cpp
+++ b/src/common/fs/fs.cpp
@@ -3,6 +3,9 @@
#include "common/fs/file.h"
#include "common/fs/fs.h"
+#ifdef ANDROID
+#include "common/fs/fs_android.h"
+#endif
#include "common/fs/path_util.h"
#include "common/logging/log.h"
@@ -525,15 +528,39 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
// Generic Filesystem Operations
bool Exists(const fs::path& path) {
+#ifdef ANDROID
+ if (Android::IsContentUri(path)) {
+ return Android::Exists(path);
+ } else {
+ return fs::exists(path);
+ }
+#else
return fs::exists(path);
+#endif
}
bool IsFile(const fs::path& path) {
+#ifdef ANDROID
+ if (Android::IsContentUri(path)) {
+ return !Android::IsDirectory(path);
+ } else {
+ return fs::is_regular_file(path);
+ }
+#else
return fs::is_regular_file(path);
+#endif
}
bool IsDir(const fs::path& path) {
+#ifdef ANDROID
+ if (Android::IsContentUri(path)) {
+ return Android::IsDirectory(path);
+ } else {
+ return fs::is_directory(path);
+ }
+#else
return fs::is_directory(path);
+#endif
}
fs::path GetCurrentDir() {
diff --git a/src/common/fs/fs_android.h b/src/common/fs/fs_android.h
index bb8a52648..b441c2a12 100644
--- a/src/common/fs/fs_android.h
+++ b/src/common/fs/fs_android.h
@@ -12,7 +12,10 @@
"openContentUri", "(Ljava/lang/String;Ljava/lang/String;)I")
#define ANDROID_SINGLE_PATH_DETERMINE_FUNCTIONS(V) \
- V(GetSize, std::uint64_t, get_size, CallStaticLongMethod, "getSize", "(Ljava/lang/String;)J")
+ V(GetSize, std::uint64_t, get_size, CallStaticLongMethod, "getSize", "(Ljava/lang/String;)J") \
+ V(IsDirectory, bool, is_directory, CallStaticBooleanMethod, "isDirectory", \
+ "(Ljava/lang/String;)Z") \
+ V(Exists, bool, file_exists, CallStaticBooleanMethod, "exists", "(Ljava/lang/String;)Z")
namespace Common::FS::Android {