diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-12-18 01:01:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 01:01:04 +0100 |
commit | b8c50276869aa98bc3cf2622a18c08cf1fb66315 (patch) | |
tree | d6771c87088db094492daf2ed39829cf5efc5873 | |
parent | Merge pull request #12378 from liamwhite/offsetof (diff) | |
parent | path_util: copy output for GetParentPath (diff) | |
download | yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar.gz yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar.bz2 yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar.lz yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar.xz yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.tar.zst yuzu-b8c50276869aa98bc3cf2622a18c08cf1fb66315.zip |
-rw-r--r-- | src/common/fs/path_util.cpp | 6 | ||||
-rw-r--r-- | src/common/fs/path_util.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index d2f50432a..4f69db6f5 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp @@ -418,9 +418,9 @@ std::string SanitizePath(std::string_view path_, DirectorySeparator directory_se return std::string(RemoveTrailingSlash(path)); } -std::string_view GetParentPath(std::string_view path) { +std::string GetParentPath(std::string_view path) { if (path.empty()) { - return path; + return std::string(path); } #ifdef ANDROID @@ -439,7 +439,7 @@ std::string_view GetParentPath(std::string_view path) { name_index = std::max(name_bck_index, name_fwd_index); } - return path.substr(0, name_index); + return std::string(path.substr(0, name_index)); } std::string_view GetPathWithoutTop(std::string_view path) { diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index 23c8b1359..59301e7ed 100644 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h @@ -302,7 +302,7 @@ enum class DirectorySeparator { DirectorySeparator directory_separator = DirectorySeparator::ForwardSlash); // Gets all of the text up to the last '/' or '\' in the path. -[[nodiscard]] std::string_view GetParentPath(std::string_view path); +[[nodiscard]] std::string GetParentPath(std::string_view path); // Gets all of the text after the first '/' or '\' in the path. [[nodiscard]] std::string_view GetPathWithoutTop(std::string_view path); |