SetupEnvironment() - clean commit

This commit is contained in:
Stuart Cardall 2014-05-13 10:15:00 +00:00 committed by langerhans
parent 20111387a7
commit 7c8d9db4e4
5 changed files with 23 additions and 1 deletions

View file

@ -58,6 +58,8 @@ static bool AppInitRPC(int argc, char* argv[])
int main(int argc, char* argv[])
{
SetupEnvironment();
try
{
if(!AppInitRPC(argc, argv))

View file

@ -172,6 +172,8 @@ bool AppInit(int argc, char* argv[])
int main(int argc, char* argv[])
{
SetupEnvironment();
bool fRet = false;
// Connect dogecoind signal handlers

View file

@ -463,6 +463,8 @@ WId BitcoinApplication::getMainWinId() const
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
SetupEnvironment();
/// 1. Parse command-line options. These take precedence over anything else.
// Command-line options take precedence:
ParseParameters(argc, argv);

View file

@ -1448,4 +1448,19 @@ bool ParseInt32(const std::string& str, int32_t *out)
n >= std::numeric_limits<int32_t>::min() &&
n <= std::numeric_limits<int32_t>::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
}

View file

@ -121,6 +121,7 @@ extern volatile bool fReopenDebugLog;
void RandAddSeed();
void RandAddSeedPerfmon();
void SetupEnvironment();
/* Return true if log accepts specified category */
bool LogAcceptCategory(const char* category);