mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Prevent boost from throwing an exception when env's locale is invalid.
This commit is contained in:
@@ -304,7 +304,7 @@ endif()
|
|||||||
macro_optional_find_package(Echonest 2.2.0)
|
macro_optional_find_package(Echonest 2.2.0)
|
||||||
macro_log_feature(ECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 2.2.0 is needed for dynamic playlists and the infosystem")
|
macro_log_feature(ECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 2.2.0 is needed for dynamic playlists and the infosystem")
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS system)
|
find_package(Boost REQUIRED COMPONENTS filesystem system)
|
||||||
macro_log_feature(Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "") #FIXME: give useful explanation
|
macro_log_feature(Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "") #FIXME: give useful explanation
|
||||||
|
|
||||||
macro_optional_find_package(Lucene++ 3.0.0)
|
macro_optional_find_package(Lucene++ 3.0.0)
|
||||||
|
@@ -198,6 +198,7 @@ TARGET_LINK_LIBRARIES( tomahawk_bin
|
|||||||
${MAC_EXTRA_LIBS}
|
${MAC_EXTRA_LIBS}
|
||||||
${ECHONEST_LIBRARIES}
|
${ECHONEST_LIBRARIES}
|
||||||
${TAGLIB_LIBRARIES}
|
${TAGLIB_LIBRARIES}
|
||||||
|
${Boost_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
IF( APPLE )
|
IF( APPLE )
|
||||||
|
@@ -43,6 +43,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
checkLocales()
|
||||||
|
{
|
||||||
|
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
|
std::locale l( "C" );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Check if env's locale is valid
|
||||||
|
l = std::locale( "" );
|
||||||
|
}
|
||||||
|
catch ( const std::runtime_error& )
|
||||||
|
{
|
||||||
|
// env's locale is invalid. Prevent boost from throwing an exception
|
||||||
|
setenv( "LC_ALL", "C", 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needs be set by main thread
|
||||||
|
boost::filesystem::path::imbue( l );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -131,6 +155,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine
|
|||||||
int
|
int
|
||||||
main( int argc, char *argv[] )
|
main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
checkLocales();
|
||||||
|
|
||||||
QCA::Initializer init;
|
QCA::Initializer init;
|
||||||
Q_UNUSED( init )
|
Q_UNUSED( init )
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user