2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

path_util: copy output for GetParentPath

This commit is contained in:
Liam 2023-12-17 14:25:42 -05:00
parent e357896674
commit 09e8fb75ce
2 changed files with 4 additions and 4 deletions

View file

@ -418,9 +418,9 @@ std::string SanitizePath(std::string_view path_, DirectorySeparator directory_se
return std::string(RemoveTrailingSlash(path)); return std::string(RemoveTrailingSlash(path));
} }
std::string_view GetParentPath(std::string_view path) { std::string GetParentPath(std::string_view path) {
if (path.empty()) { if (path.empty()) {
return path; return std::string(path);
} }
#ifdef ANDROID #ifdef ANDROID
@ -439,7 +439,7 @@ std::string_view GetParentPath(std::string_view path) {
name_index = std::max(name_bck_index, name_fwd_index); 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) { std::string_view GetPathWithoutTop(std::string_view path) {

View file

@ -302,7 +302,7 @@ enum class DirectorySeparator {
DirectorySeparator directory_separator = DirectorySeparator::ForwardSlash); DirectorySeparator directory_separator = DirectorySeparator::ForwardSlash);
// Gets all of the text up to the last '/' or '\' in the path. // 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. // Gets all of the text after the first '/' or '\' in the path.
[[nodiscard]] std::string_view GetPathWithoutTop(std::string_view path); [[nodiscard]] std::string_view GetPathWithoutTop(std::string_view path);