Fix codecvt errors on OS X

When launching Aegisub from Finder (but not via open), using the UTF-8
version of the locale breaks things for whatever reason, but fortunately
it's unneccesary as paths on OS X are always UTF-8 even if the locale
isn't.

Closes #1685.
This commit is contained in:
Thomas Goyne 2014-01-12 09:53:24 -08:00
parent 71cd017f0f
commit 2de6a8b600

View file

@ -117,7 +117,15 @@ bool AegisubApp::OnInit() {
// Set the global locale to the utf-8 version of the current locale // Set the global locale to the utf-8 version of the current locale
std::locale::global(boost::locale::generator().generate("")); std::locale::global(boost::locale::generator().generate(""));
#ifndef __APPLE__
// Boost.FileSystem always uses UTF-8 for paths on OS X (since paths
// actually are required to be UTF-8 strings rather than just opaque binary
// blobs like on Linux), so there's no need to imbue the new locale and in
// fact it actively breaks things for unknown reasons when launching the
// app from Finder (but not from the command line).
boost::filesystem::path::imbue(std::locale()); boost::filesystem::path::imbue(std::locale());
#endif
// Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494 // Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494
agi::dispatch::Init([this](agi::dispatch::Thunk f) { agi::dispatch::Init([this](agi::dispatch::Thunk f) {