boost: fix boost_filesystem for locale support.

Needed to get vcmi working, will help with anything using
boost_filesystem.
This commit is contained in:
Adrien Destugues
2014-01-27 20:42:44 +01:00
parent 7eafe431be
commit 2f093b8389

View File

@@ -424,3 +424,46 @@ index 6ce2ea1..3b303eb 100644
--
1.8.3.4
From d94967fa8fdea2842ec02fab90df0ec4efaac685 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 9 Jan 2014 22:40:40 +0100
Subject: filesystem: don't crash because of unsupported locale in libstdc++
See https://svn.boost.org/trac/boost/ticket/4688
We do the same as on Mac OS X and assume the filesystem uses utf-8.
diff --git a/libs/filesystem/src/path.cpp b/libs/filesystem/src/path.cpp
index c740dec..3285d39 100644
--- a/libs/filesystem/src/path.cpp
+++ b/libs/filesystem/src/path.cpp
@@ -35,7 +35,7 @@
#ifdef BOOST_WINDOWS_API
# include "windows_file_codecvt.hpp"
# include <windows.h>
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__HAIKU__)
# include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
#endif
@@ -828,7 +828,7 @@ namespace
codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
(path_locale));
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__HAIKU__)
// "All BSD system functions expect their string parameters to be in UTF-8 encoding
// and nothing else." See
@@ -903,7 +903,7 @@ namespace filesystem
const path::codecvt_type& path::codecvt()
{
# if defined(BOOST_POSIX_API) && \
- !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+ !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__HAIKU__))
// A local static initialized by calling path::imbue ensures that std::locale(""),
// which may throw, is called only if path_locale and condecvt_facet will actually
// be used. Thus misconfigured environmental variables will only cause an
--
1.8.3.4