Rearrange main.cpp, so no GetConfigPath() is called before instanciating QApplication and CheckPortable().

This commit is contained in:
Andreas 2013-10-10 18:36:12 +02:00
parent 4584b50d18
commit 8b8d3e2849
1 changed files with 12 additions and 13 deletions

View File

@ -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());