From 5248ff40997c64cc0fde7aaa67cf94dd38b14899 Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Tue, 13 May 2014 10:15:00 +0000 Subject: SetupEnvironment() - clean commit --- src/util.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index 00e29446d5..2e8500eeae 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1404,3 +1404,19 @@ bool ParseInt32(const std::string& str, int32_t *out) n <= std::numeric_limits::max(); } +void SetupEnvironment() +{ + #ifndef WIN32 + try + { + #if BOOST_FILESYSTEM_VERSION == 3 + boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid + #else // boost filesystem v2 + std::locale(); // Raises runtime error if current locale is invalid + #endif + } catch(std::runtime_error &e) + { + setenv("LC_ALL", "C", 1); // Force C locale + } + #endif +} -- cgit v1.2.3