replace Glib::filename_to_utf8 with custom fname_to_utf8

(cherry picked from commit 30b4daf9077e3c6780cefbf6c4223da4698b8612)
This commit is contained in:
Alberto Griggio
2022-07-06 07:04:24 -07:00
committed by Lawrence Lee
parent eb7c151260
commit 7324ea7230
4 changed files with 27 additions and 41 deletions

View File

@@ -44,6 +44,7 @@
#include "extprog.h"
#include "../rtengine/dynamicprofile.h"
#include "../rtengine/procparams.h"
#include "pathutils.h"
#ifndef WIN32
#include <glibmm/fileutils.h>
@@ -71,27 +72,7 @@ bool remote = false;
unsigned char initialGdkScale = 1;
//Glib::Threads::Thread* mainThread;
namespace
{
// For an unknown reason, Glib::filename_to_utf8 doesn't work on reliably Windows,
// so we're using Glib::filename_to_utf8 for Linux/Apple and Glib::locale_to_utf8 for Windows.
Glib::ustring fname_to_utf8 (const char* fname)
{
#ifdef WIN32
try {
return Glib::locale_to_utf8 (fname);
} catch (Glib::Error&) {
return Glib::convert_with_fallback (fname, "UTF-8", "ISO-8859-1", "?");
}
#else
return Glib::filename_to_utf8 (fname);
#endif
}
namespace {
// This recursive mutex will be used by gdk_threads_enter/leave instead of a simple mutex
static Glib::Threads::RecMutex myGdkRecMutex;