| 323 | } |
| 324 | |
| 325 | MeasurementFormat GetLocaleMeasurementFormat() |
| 326 | { |
| 327 | // LC_MEASUREMENT is GNU specific. |
| 328 | #ifdef LC_MEASUREMENT |
| 329 | const char* langstring = setlocale(LC_MEASUREMENT, ""); |
| 330 | #else |
| 331 | const char* langstring = setlocale(LC_ALL, ""); |
| 332 | #endif |
| 333 | |
| 334 | if (langstring != nullptr) |
| 335 | { |
| 336 | // using https://en.wikipedia.org/wiki/Metrication#Chronology_and_status_of_conversion_by_country as reference |
| 337 | if (!fnmatch("*_US*", langstring, 0) || !fnmatch("*_MM*", langstring, 0) || !fnmatch("*_LR*", langstring, 0)) |
| 338 | { |
| 339 | return MeasurementFormat::imperial; |
| 340 | } |
| 341 | } |
| 342 | return MeasurementFormat::metric; |
| 343 | } |
| 344 | |
| 345 | SteamPaths GetSteamPaths() |
| 346 | { |