summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2023-06-16 03:39:14 +0200
committerGitHub <noreply@github.com>2023-06-16 03:39:14 +0200
commit9a04793ae865b7dba009d3133950636eb7ede845 (patch)
tree4fa07212a74c4a7409374e18b1e2442d65f929cd /src/android/app/src/main/java/org
parentMerge pull request #10790 from liamwhite/arm-driver-moment (diff)
parentandroid: fs: Fix Exists / IsFile for SAF. (diff)
downloadyuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar.gz
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar.bz2
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar.lz
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar.xz
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.tar.zst
yuzu-9a04793ae865b7dba009d3133950636eb7ede845.zip
Diffstat (limited to 'src/android/app/src/main/java/org')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt18
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DocumentsTree.kt5
2 files changed, 23 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
index 22f0a2646..f3bfbe7eb 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
@@ -19,6 +19,8 @@ import org.yuzu.yuzu_emu.activities.EmulationActivity
import org.yuzu.yuzu_emu.utils.DocumentsTree.Companion.isNativePath
import org.yuzu.yuzu_emu.utils.FileUtil.getFileSize
import org.yuzu.yuzu_emu.utils.FileUtil.openContentUri
+import org.yuzu.yuzu_emu.utils.FileUtil.exists
+import org.yuzu.yuzu_emu.utils.FileUtil.isDirectory
import org.yuzu.yuzu_emu.utils.Log.error
import org.yuzu.yuzu_emu.utils.Log.verbose
import org.yuzu.yuzu_emu.utils.Log.warning
@@ -85,6 +87,22 @@ object NativeLibrary {
} else getFileSize(appContext, path)
}
+ @Keep
+ @JvmStatic
+ fun exists(path: String?): Boolean {
+ return if (isNativePath(path!!)) {
+ YuzuApplication.documentsTree!!.exists(path)
+ } else exists(appContext, path)
+ }
+
+ @Keep
+ @JvmStatic
+ fun isDirectory(path: String?): Boolean {
+ return if (isNativePath(path!!)) {
+ YuzuApplication.documentsTree!!.isDirectory(path)
+ } else isDirectory(appContext, path)
+ }
+
/**
* Returns true if pro controller isn't available and handheld is
*/
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DocumentsTree.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DocumentsTree.kt
index cc8ea6b9d..f8abae445 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DocumentsTree.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DocumentsTree.kt
@@ -36,6 +36,11 @@ class DocumentsTree {
return resolvePath(filepath) != null
}
+ fun isDirectory(filepath: String): Boolean {
+ val node = resolvePath(filepath)
+ return node != null && node.isDirectory
+ }
+
private fun resolvePath(filepath: String): DocumentsNode? {
val tokens = StringTokenizer(filepath, File.separator, false)
var iterator = root