You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.2 KiB
79 lines
2.2 KiB
From 17816ed02f59bab9c27310e7f24c73266b0a3003 Mon Sep 17 00:00:00 2001
|
|
From: persmule <persmule@gmail.com>
|
|
Date: Wed, 5 Oct 2016 13:47:46 +0800
|
|
Subject: [PATCH] Add a routine to set file name conversion for amuled which
|
|
based on wxAppConsole
|
|
|
|
---
|
|
src/amule.h | 7 +++++++
|
|
src/amuled.cpp | 35 +++++++++++++++++++++++++++++++++++
|
|
2 files changed, 42 insertions(+)
|
|
|
|
diff --git a/src/amule.h b/src/amule.h
|
|
index f25702f60..240c02dd9 100644
|
|
--- a/src/amule.h
|
|
+++ b/src/amule.h
|
|
@@ -553,6 +553,13 @@ private:
|
|
int OnExit();
|
|
|
|
virtual int InitGui(bool geometry_enable, wxString &geometry_string);
|
|
+ // The GTK wxApps sets its file name conversion properly
|
|
+ // in wxApp::Initialize(), while wxAppConsole::Initialize()
|
|
+ // does not, leaving wxConvFile being set to wxConvLibc. File
|
|
+ // name conversion should be set otherwise amuled will abort to
|
|
+ // handle non-ASCII file names which monolithic amule can handle.
|
|
+ // This function are overrided to perform this.
|
|
+ virtual bool Initialize(int& argc_, wxChar **argv_);
|
|
|
|
#ifdef AMULED_APPTRAITS
|
|
struct sigaction m_oldSignalChildAction;
|
|
diff --git a/src/amuled.cpp b/src/amuled.cpp
|
|
index 486da5973..86e1ff8b8 100644
|
|
--- a/src/amuled.cpp
|
|
+++ b/src/amuled.cpp
|
|
@@ -704,6 +704,41 @@ int CamuleDaemonApp::InitGui(bool ,wxString &)
|
|
return 0;
|
|
}
|
|
|
|
+bool CamuleDaemonApp::Initialize(int& argc_, wxChar **argv_)
|
|
+{
|
|
+ if ( !wxAppConsole::Initialize(argc_, argv_) ) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+#ifdef __UNIX__
|
|
+ wxString encName;
|
|
+#if wxUSE_INTL
|
|
+ // if a non default locale is set,
|
|
+ // assume that the user wants his
|
|
+ // filenames in this locale too
|
|
+ encName = wxLocale::GetSystemEncodingName().Upper();
|
|
+
|
|
+ // But don't consider ASCII in this case.
|
|
+ if ( !encName.empty() ) {
|
|
+ if ( encName == wxT("US-ASCII") ) {
|
|
+ // This means US-ASCII when returned
|
|
+ // from GetEncodingFromName().
|
|
+ encName.clear();
|
|
+ }
|
|
+ }
|
|
+#endif // wxUSE_INTL
|
|
+
|
|
+ // in this case, UTF-8 is used by default.
|
|
+ if ( encName.empty() ) {
|
|
+ encName = wxT("UTF-8");
|
|
+ }
|
|
+
|
|
+ static wxConvBrokenFileNames fileconv(encName);
|
|
+ wxConvFileName = &fileconv;
|
|
+#endif // __UNIX__
|
|
+
|
|
+ return true;
|
|
+}
|
|
|
|
int CamuleDaemonApp::OnExit()
|
|
{
|
|
--
|
|
2.16.4
|
|
|