diff options
| author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-21 10:13:10 +0000 |
|---|---|---|
| committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-21 10:13:10 +0000 |
| commit | f3724aef881ff2fdada98eddc792059e4e18c1c8 (patch) | |
| tree | 492dc86b5344060870877c0a886f67d2c1eaa0b8 /src/simplewallet | |
| parent | 0c1dae32b4e47417ec46f261014a888d4ca33348 (diff) | |
| download | monzero-core-f3724aef881ff2fdada98eddc792059e4e18c1c8.tar.gz monzero-core-f3724aef881ff2fdada98eddc792059e4e18c1c8.tar.xz monzero-core-f3724aef881ff2fdada98eddc792059e4e18c1c8.zip | |
Fix startup crash when using a locale boost does not like
There are various locale related bugs in various versions of boost,
where exceptions are thrown in boost::filesystem APIs when the
current locale is not to boost's liking. It's not clear what "not
to boost's liking" means in detail, though "en" and "en_US.UTF-8"
are not to its liking.
Fix it by running a test function that's known to throw in such
a case, and resetting LANG and LC_ALL to C if an exception is
thrown. In simplewallet, the locale is queried before that so the
correct translations will still be used.
Diffstat (limited to 'src/simplewallet')
| -rw-r--r-- | src/simplewallet/simplewallet.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 3d7a23d5e..3e1ca4210 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2164,6 +2164,9 @@ int main(int argc, char* argv[]) //TRY_ENTRY(); + std::string lang = i18n_get_language(); + tools::sanitize_locale(); + string_tools::set_module_name_and_folder(argv[0]); po::options_description desc_general(sw::tr("General options")); @@ -2212,7 +2215,7 @@ int main(int argc, char* argv[]) po::positional_options_description positional_options; positional_options.add(arg_command.name, -1); - i18n_set_language("translations", "monero"); + i18n_set_language("translations", "monero", lang); po::options_description desc_all; desc_all.add(desc_general).add(desc_params); |
