Rearrange main.cpp, so no GetConfigPath() is called before instanciating QApplication and CheckPortable().
This commit is contained in:
parent
4584b50d18
commit
8b8d3e2849
25
src/main.cpp
25
src/main.cpp
|
@ -238,8 +238,6 @@ void CheckPortable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
CheckPortable();
|
|
||||||
|
|
||||||
if (CrashReporting::SendCrashReport(argc, argv)) {
|
if (CrashReporting::SendCrashReport(argc, argv)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -257,11 +255,6 @@ int main(int argc, char *argv[]) {
|
||||||
QCoreApplication::setOrganizationName("Clementine");
|
QCoreApplication::setOrganizationName("Clementine");
|
||||||
QCoreApplication::setOrganizationDomain("clementine-player.org");
|
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
|
// This makes us show up nicely in gnome-volume-control
|
||||||
#if !GLIB_CHECK_VERSION(2, 36, 0)
|
#if !GLIB_CHECK_VERSION(2, 36, 0)
|
||||||
g_type_init(); // Deprecated in glib 2.36.0
|
g_type_init(); // Deprecated in glib 2.36.0
|
||||||
|
@ -270,12 +263,6 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
RegisterMetaTypes();
|
RegisterMetaTypes();
|
||||||
|
|
||||||
#ifdef HAVE_LIBLASTFM
|
|
||||||
lastfm::ws::ApiKey = LastFMService::kApiKey;
|
|
||||||
lastfm::ws::SharedSecret = LastFMService::kSecret;
|
|
||||||
lastfm::setNetworkAccessManager(new NetworkAccessManager);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CommandlineOptions options(argc, argv);
|
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
|
// This MUST be done before parsing the commandline options so QTextCodec
|
||||||
// gets the right system locale for filenames.
|
// gets the right system locale for filenames.
|
||||||
QtSingleCoreApplication a(argc, argv);
|
QtSingleCoreApplication a(argc, argv);
|
||||||
|
CheckPortable();
|
||||||
crash_reporting.SetApplicationPath(a.applicationFilePath());
|
crash_reporting.SetApplicationPath(a.applicationFilePath());
|
||||||
|
|
||||||
// Parse commandline options - need to do this before starting the
|
// 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
|
// Initialise logging
|
||||||
logging::Init();
|
logging::Init();
|
||||||
logging::SetLevels(options.log_levels());
|
logging::SetLevels(options.log_levels());
|
||||||
|
|
Loading…
Reference in New Issue