diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index d022414efc..31b5e3cd37 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -107,7 +107,7 @@ std::vector DoFileSearch(const std::vector& directorie if constexpr (os_separator != DIR_SEP_CHR) { for (auto& path : result) - std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR); + std::ranges::replace(path, '\\', DIR_SEP_CHR); } return result; diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 545bfaba44..ee2b330812 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -446,7 +446,7 @@ FSTEntry ScanDirectoryTree(std::string directory, bool recursive) // about with directory separators (for host paths - emulated paths may require it) and instead // use fs::path to interact with them. auto wpath = path.wstring(); - std::replace(wpath.begin(), wpath.end(), L'\\', L'/'); + std::ranges::replace(wpath, L'\\', L'/'); return WStringToUTF8(wpath); #else return PathToString(path); diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index d3e7caacdf..935db75d2f 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -234,8 +234,8 @@ std::string_view StripQuotes(std::string_view s) // Turns "\n\rhello" into " hello". void ReplaceBreaksWithSpaces(std::string& str) { - std::replace(str.begin(), str.end(), '\r', ' '); - std::replace(str.begin(), str.end(), '\n', ' '); + std::ranges::replace(str, '\r', ' '); + std::ranges::replace(str, '\n', ' '); } void TruncateToCString(std::string* s) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 07ca7498da..7eefe9b945 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -265,7 +265,7 @@ struct SetGameMetadata std::string executable_path = executable.path; constexpr char BACKSLASH = '\\'; constexpr char FORWARDSLASH = '/'; - std::replace(executable_path.begin(), executable_path.end(), BACKSLASH, FORWARDSLASH); + std::ranges::replace(executable_path, BACKSLASH, FORWARDSLASH); config->SetRunningGameMetadata(SConfig::MakeGameID(PathToFileName(executable_path))); Host_TitleChanged(); diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index d0f8345852..382c59d696 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -225,7 +225,7 @@ void SetLocale(std::string locale_name) if (locale_name == "en") locale_name = "en_GB"; - std::replace(locale_name.begin(), locale_name.end(), OTHER_SEPARATOR, PREFERRED_SEPARATOR); + std::ranges::replace(locale_name, OTHER_SEPARATOR, PREFERRED_SEPARATOR); // Use the specified locale if supported. if (set_locale(locale_name))