summaryrefslogtreecommitdiff
path: root/src/common/fs/path_util.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-10-30 13:28:11 -0400
committerGitHub <noreply@github.com>2023-10-30 13:28:11 -0400
commit07276cf62ad5a32ae7a9867029a05a4fbb141d5c (patch)
tree3eaac7c7fe07db8b44893341ec885e4dfc31d8c8 /src/common/fs/path_util.cpp
parent79d3cef8db5c6e43463434f966316caaa685488f (diff)
parentf04bc172ae4a24ae4431d65eabfedcc8667eb0bd (diff)
Merge pull request #11908 from t895/log-spam
android: Fix URI parsing 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
}
std::string_view GetParentPath(std::string_view path) {
+ if (path.empty()) {
+ return path;
+ }
+
+#ifdef ANDROID
+ if (path[0] != '/') {
+ std::string path_string{path};
+ return FS::Android::GetParentDirectory(path_string);
+ }
+#endif
const auto name_bck_index = path.rfind('\\');
const auto name_fwd_index = path.rfind('/');
std::size_t name_index;