diff options
| author | 2023-10-24 22:51:09 -0400 | |
|---|---|---|
| committer | 2023-10-30 11:38:10 -0400 | |
| commit | 585b6e9d46b207a6b48a021ea35636fb8c92b405 (patch) | |
| tree | 8909909ba82a90979748d6fa2bd875aa47cea050 /src/common/string_util.cpp | |
| parent | android: Refactor game metadata collection to new file (diff) | |
| download | yuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.tar.gz yuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.tar.xz yuzu-585b6e9d46b207a6b48a021ea35636fb8c92b405.zip | |
android: Fix resolving android URIs in native code
Diffstat (limited to 'src/common/string_util.cpp')
| -rw-r--r-- | src/common/string_util.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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 @@ | |||
| 14 | #include <windows.h> | 14 | #include <windows.h> |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | #ifdef ANDROID | ||
| 18 | #include <common/fs/fs_android.h> | ||
| 19 | #endif | ||
| 20 | |||
| 17 | namespace Common { | 21 | namespace Common { |
| 18 | 22 | ||
| 19 | /// Make a string lowercase | 23 | /// Make a string lowercase |
| @@ -63,6 +67,14 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ | |||
| 63 | if (full_path.empty()) | 67 | if (full_path.empty()) |
| 64 | return false; | 68 | return false; |
| 65 | 69 | ||
| 70 | #ifdef ANDROID | ||
| 71 | if (full_path[0] != '/') { | ||
| 72 | *_pPath = Common::FS::Android::GetParentDirectory(full_path); | ||
| 73 | *_pFilename = Common::FS::Android::GetFilename(full_path); | ||
| 74 | return true; | ||
| 75 | } | ||
| 76 | #endif | ||
| 77 | |||
| 66 | std::size_t dir_end = full_path.find_last_of("/" | 78 | std::size_t dir_end = full_path.find_last_of("/" |
| 67 | // windows needs the : included for something like just "C:" to be considered a directory | 79 | // windows needs the : included for something like just "C:" to be considered a directory |
| 68 | #ifdef _WIN32 | 80 | #ifdef _WIN32 |