summaryrefslogtreecommitdiff
path: root/src/common/fs/path_util.cpp
diff options
context:
space:
mode:
authorGravatar Charles Lombardo2023-10-24 22:51:09 -0400
committerGravatar Charles Lombardo2023-10-30 11:38:10 -0400
commit585b6e9d46b207a6b48a021ea35636fb8c92b405 (patch)
tree8909909ba82a90979748d6fa2bd875aa47cea050 /src/common/fs/path_util.cpp
parentandroid: Refactor game metadata collection to new file (diff)
downloadyuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.tar.gz
yuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.tar.xz
yuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.zip
android: Fix resolving android URIs in native code
Diffstat (limited to 'src/common/fs/path_util.cpp')
-rw-r--r--src/common/fs/path_util.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp
index 0c4c88cde..c3a81f9a9 100644
--- a/src/common/fs/path_util.cpp
+++ b/src/common/fs/path_util.cpp
@@ -401,6 +401,16 @@ std::string SanitizePath(std::string_view path_, DirectorySeparator directory_se
401} 401}
402 402
403std::string_view GetParentPath(std::string_view path) { 403std::string_view GetParentPath(std::string_view path) {
404 if (path.empty()) {
405 return path;
406 }
407
408#ifdef ANDROID
409 if (path[0] != '/') {
410 std::string path_string{path};
411 return FS::Android::GetParentDirectory(path_string);
412 }
413#endif
404 const auto name_bck_index = path.rfind('\\'); 414 const auto name_bck_index = path.rfind('\\');
405 const auto name_fwd_index = path.rfind('/'); 415 const auto name_fwd_index = path.rfind('/');
406 std::size_t name_index; 416 std::size_t name_index;