From 585b6e9d46b207a6b48a021ea35636fb8c92b405 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 24 Oct 2023 22:51:09 -0400 Subject: android: Fix resolving android URIs in native code --- src/common/string_util.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 4c7aba3f5..72c481798 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -14,6 +14,10 @@ #include #endif +#ifdef ANDROID +#include +#endif + namespace Common { /// Make a string lowercase @@ -63,6 +67,14 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ if (full_path.empty()) return false; +#ifdef ANDROID + if (full_path[0] != '/') { + *_pPath = Common::FS::Android::GetParentDirectory(full_path); + *_pFilename = Common::FS::Android::GetFilename(full_path); + return true; + } +#endif + std::size_t dir_end = full_path.find_last_of("/" // windows needs the : included for something like just "C:" to be considered a directory #ifdef _WIN32 -- cgit v1.2.3