| 757 | } |
| 758 | |
| 759 | void SetupEnvironment() |
| 760 | { |
| 761 | // On most POSIX systems (e.g. Linux, but not BSD) the environment's locale |
| 762 | // may be invalid, in which case the "C" locale is used as fallback. |
| 763 | #if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) |
| 764 | try { |
| 765 | std::locale(""); // Raises a runtime error if current locale is invalid |
| 766 | } catch (const std::runtime_error&) { |
| 767 | setenv("LC_ALL", "C", 1); |
| 768 | } |
| 769 | #endif |
| 770 | // The path locale is lazy initialized and to avoid deinitialization errors |
| 771 | // in multithreading environments, it is set explicitly by the main thread. |
| 772 | // A dummy locale is used to extract the internal default locale, used by |
| 773 | // boost::filesystem::path, which is then used to explicitly imbue the path. |
| 774 | std::locale loc = boost::filesystem::path::imbue(std::locale::classic()); |
| 775 | boost::filesystem::path::imbue(loc); |
| 776 | } |
| 777 | |
| 778 | bool SetupNetworking() |
| 779 | { |