Fix the failed to set locale on devices that don't have us english (like my phone) ()

This commit is contained in:
Talis 2024-02-26 21:50:43 +11:00 committed by GitHub
parent 0d64935a11
commit 6ee63091de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,7 +113,7 @@ namespace geode {
Num val;
char* strEnd;
errno = 0;
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
if (std::setlocale(LC_NUMERIC, "C")) {
if constexpr (std::is_same_v<Num, float>) val = std::strtof(str.data(), &strEnd);
else if constexpr (std::is_same_v<Num, double>) val = std::strtod(str.data(), &strEnd);
else if constexpr (std::is_same_v<Num, long double>) val = std::strtold(str.data(), &strEnd);