mirror of
https://github.com/VARCem/munt.git
synced 2026-07-08 18:16:13 +00:00
Reworked the support for accessing ROM files with localised pathnames
introduced in libmt32emu version 2.3.0 Since it is not really necessary in majority of cases but may nevertheless update global C and C++ locale settings, it must now be explicitly enabled with the new Cmake option libmt32emu_INSTALL_DEFAULT_LOCALE. Also, it no longer touches the global C++ locale even if enabled, since that appears to have no positive effect. So far, it has been found useful for building shared library with some old versions of MS VC when linking C runtime statically. Also, mt32emu-qt now only initialises C locale upon startup.
This commit is contained in:
@@ -42,6 +42,11 @@ if(libmt32emu_SHARED)
|
||||
set_property(CACHE libmt32emu_PACKAGE_TYPE
|
||||
PROPERTY STRINGS Complete Runtime Devel
|
||||
)
|
||||
option(libmt32emu_INSTALL_DEFAULT_LOCALE "Install user-preferred system locale as C locale when initialising shared library.\
|
||||
This is generally not necessary, although may be required in some cases\
|
||||
(for instance, when builing shared library with old versions of MS VC with the C runtime statically linked)\
|
||||
to open ROM files with localised pathnames successfully." FALSE)
|
||||
mark_as_advanced(libmt32emu_INSTALL_DEFAULT_LOCALE)
|
||||
else()
|
||||
set(libmt32emu_PACKAGE_TYPE Complete)
|
||||
endif()
|
||||
@@ -148,6 +153,9 @@ if(libmt32emu_SHARED)
|
||||
if(NOT OS2)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
if(libmt32emu_INSTALL_DEFAULT_LOCALE)
|
||||
add_definitions(-DMT32EMU_INSTALL_DEFAULT_LOCALE)
|
||||
endif()
|
||||
endif(libmt32emu_SHARED)
|
||||
|
||||
if(NOT libmt32emu_CURRENT_EXPORTS_TYPE STREQUAL libmt32emu_EXPORTS_TYPE)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
HEAD:
|
||||
|
||||
* Reworked the support for accessing ROM files with localised pathnames introduced in 2.3.0.
|
||||
Since it is not really necessary in majority of cases but may nevertheless update global
|
||||
C and C++ locale settings, it must now be explicitly enabled with the new Cmake option
|
||||
libmt32emu_INSTALL_DEFAULT_LOCALE. Also, it no longer touches the global C++ locale
|
||||
even if enabled, since that appears to have no positive effect. So far, it has been found
|
||||
useful for building shared library with some old versions of MS VC when linking C runtime
|
||||
statically.
|
||||
|
||||
2020-10-07:
|
||||
|
||||
2.4.1 released.
|
||||
|
||||
@@ -25,17 +25,18 @@
|
||||
|
||||
namespace MT32Emu {
|
||||
|
||||
// This initialises C locale with the user-preferred system locale once facilitating access
|
||||
// to ROM files with localised pathnames. This is only necessary in rare cases e.g. when building
|
||||
// shared library statically linked with C runtime with old MS VC versions, so that the C locale
|
||||
// set by the client application does not have effect, and thus such ROM files cannot be opened.
|
||||
static inline void configureSystemLocale() {
|
||||
#ifdef MT32EMU_SHARED
|
||||
#if defined MT32EMU_SHARED && defined MT32EMU_INSTALL_DEFAULT_LOCALE
|
||||
static bool configured = false;
|
||||
|
||||
if (configured) return;
|
||||
configured = true;
|
||||
# if defined __CYGWIN__ || defined __OS2__
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
# else
|
||||
std::locale::global(std::locale(""));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,7 @@ int main(int argv, char **args) {
|
||||
app.setApplicationName("Munt mt32emu-qt");
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
{
|
||||
#if defined __CYGWIN__ || defined __OS2__
|
||||
setlocale(LC_ALL, "");
|
||||
#else
|
||||
std::locale::global(std::locale(""));
|
||||
#endif
|
||||
Master master;
|
||||
QSystemTrayIcon *trayIcon = NULL;
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
|
||||
Reference in New Issue
Block a user