mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Common: Replace StringBeginsWith/StringEndsWith with std equivalents
Obsoletes these functions in favor of the standard member functions added in C++20.
This commit is contained in:
@ -64,13 +64,13 @@ FileDataLoaderHostFS::MakeAbsoluteFromRelative(std::string_view external_relativ
|
||||
return std::nullopt;
|
||||
#endif
|
||||
|
||||
std::string result = StringBeginsWith(external_relative_path, "/") ? m_sd_root : m_patch_root;
|
||||
std::string result = external_relative_path.starts_with('/') ? m_sd_root : m_patch_root;
|
||||
std::string_view work = external_relative_path;
|
||||
|
||||
// Strip away all leading and trailing path separators.
|
||||
while (StringBeginsWith(work, "/"))
|
||||
while (work.starts_with('/'))
|
||||
work.remove_prefix(1);
|
||||
while (StringEndsWith(work, "/"))
|
||||
while (work.ends_with('/'))
|
||||
work.remove_suffix(1);
|
||||
size_t depth = 0;
|
||||
while (true)
|
||||
@ -126,7 +126,7 @@ FileDataLoaderHostFS::MakeAbsoluteFromRelative(std::string_view external_relativ
|
||||
work = work.substr(separator_position + 1);
|
||||
|
||||
// Remove any potential extra path separators.
|
||||
while (StringBeginsWith(work, "/"))
|
||||
while (work.starts_with('/'))
|
||||
work = work.substr(1);
|
||||
}
|
||||
return result;
|
||||
@ -425,9 +425,9 @@ static void ApplyFolderPatchToFST(const Patch& patch, const Folder& folder,
|
||||
return std::string(b);
|
||||
if (b.empty())
|
||||
return std::string(a);
|
||||
if (StringEndsWith(a, "/"))
|
||||
if (a.ends_with('/'))
|
||||
a.remove_suffix(1);
|
||||
if (StringBeginsWith(b, "/"))
|
||||
if (b.starts_with('/'))
|
||||
b.remove_prefix(1);
|
||||
return fmt::format("{}/{}", a, b);
|
||||
};
|
||||
|
Reference in New Issue
Block a user