Use std::replace rather than string::replace

This commit is contained in:
Paul Fd 2023-09-24 23:28:04 +02:00 committed by Paul Ferrand
parent 5d663a7969
commit c87b4ecc33

View file

@ -16,12 +16,14 @@
#if defined(_WIN32) #if defined(_WIN32)
const fs::path toPlatformAgnosticPath(std::string& filePath) const fs::path toPlatformAgnosticPath(std::string& filePath)
{ {
return fs::u8path(filePath.replace(filePath.begin(), filePath.end(), '\\', '/')); std::replace(filePath.begin(), filePath.end(), '\\', '/');
return fs::u8path(filePath);
} }
const fs::path fromPlatformAgnosticPath(const char *filePath) const fs::path fromPlatformAgnosticPath(const char *filePath)
{ {
std::string p { filePath }; std::string p { filePath };
return fs::u8path(p.replace(p.begin(), p.end(), '/', '\\')); std::replace(p.begin(), p.end(), '/', '\\');
return fs::u8path(p);
} }
#else #else
const fs::path toPlatformAgnosticPath(std::string& filePath) const fs::path toPlatformAgnosticPath(std::string& filePath)