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 b6e616c5f3
commit 1d90cda8f3
1 changed files with 8 additions and 0 deletions

View File

@ -118,7 +118,15 @@ bool AegisubApp::OnInit() {
// Set the global locale to the utf-8 version of the current locale
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());
#endif
// Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494
agi::dispatch::Init([this](agi::dispatch::Thunk f) {