From 8b8d3e28494def01d5248fecfa3b730e5fcc7d3d Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 10 Oct 2013 18:36:12 +0200 Subject: [PATCH] Rearrange main.cpp, so no GetConfigPath() is called before instanciating QApplication and CheckPortable(). --- src/main.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 66682e305..f51c4d9a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -238,8 +238,6 @@ void CheckPortable() { } int main(int argc, char *argv[]) { - CheckPortable(); - if (CrashReporting::SendCrashReport(argc, argv)) { return 0; } @@ -257,11 +255,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("Clementine"); QCoreApplication::setOrganizationDomain("clementine-player.org"); -#ifdef Q_OS_DARWIN - // Must happen after QCoreApplication::setOrganizationName(). - setenv("XDG_CONFIG_HOME", Utilities::GetConfigPath(Utilities::Path_Root).toLocal8Bit().constData(), 1); -#endif - // This makes us show up nicely in gnome-volume-control #if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); // Deprecated in glib 2.36.0 @@ -270,12 +263,6 @@ int main(int argc, char *argv[]) { RegisterMetaTypes(); -#ifdef HAVE_LIBLASTFM - lastfm::ws::ApiKey = LastFMService::kApiKey; - lastfm::ws::SharedSecret = LastFMService::kSecret; - lastfm::setNetworkAccessManager(new NetworkAccessManager); -#endif - CommandlineOptions options(argc, argv); { @@ -284,6 +271,7 @@ int main(int argc, char *argv[]) { // This MUST be done before parsing the commandline options so QTextCodec // gets the right system locale for filenames. QtSingleCoreApplication a(argc, argv); + CheckPortable(); crash_reporting.SetApplicationPath(a.applicationFilePath()); // Parse commandline options - need to do this before starting the @@ -302,6 +290,17 @@ int main(int argc, char *argv[]) { } } +#ifdef Q_OS_DARWIN + // Must happen after QCoreApplication::setOrganizationName(). + setenv("XDG_CONFIG_HOME", Utilities::GetConfigPath(Utilities::Path_Root).toLocal8Bit().constData(), 1); +#endif + +#ifdef HAVE_LIBLASTFM + lastfm::ws::ApiKey = LastFMService::kApiKey; + lastfm::ws::SharedSecret = LastFMService::kSecret; + lastfm::setNetworkAccessManager(new NetworkAccessManager); +#endif + // Initialise logging logging::Init(); logging::SetLevels(options.log_levels());