Fix C:\data cache directory for portable builds

Lastfm needs a NetworkAccessManager which is created during the
initialization of lastfm in main.cpp, it also sets a cache directory.

For the portable version, GetConfigPath uses
QCoreApplication::applicationDirPath() to get the current directory of
Clementine. If no QApplication (or QtSingleApplication in Clementines
case) was instantiated, it returns /data on Linux or C:\data on Windows
for the cache config path.

This commit changes the order so lastfm will be initialized after
QtSingleApplication was created and the correct cache config path will be
returned.

Fixes #5354
This commit is contained in:
Andreas Muttscheller 2017-02-26 11:20:10 +01:00
parent 1aed6193e7
commit 652f38ac84
1 changed files with 6 additions and 6 deletions

View File

@ -318,12 +318,6 @@ int main(int argc, char* argv[]) {
1);
#endif
#ifdef HAVE_LIBLASTFM
lastfm::ws::ApiKey = LastFMService::kApiKey;
lastfm::ws::SharedSecret = LastFMService::kSecret;
lastfm::setNetworkAccessManager(new NetworkAccessManager);
#endif
// Output the version, so when people attach log output to bug reports they
// don't have to tell us which version they're using.
qLog(Info) << "Clementine" << CLEMENTINE_VERSION_DISPLAY;
@ -337,6 +331,12 @@ int main(int argc, char* argv[]) {
QtSingleApplication a(argc, argv);
#ifdef HAVE_LIBLASTFM
lastfm::ws::ApiKey = LastFMService::kApiKey;
lastfm::ws::SharedSecret = LastFMService::kSecret;
lastfm::setNetworkAccessManager(new NetworkAccessManager);
#endif
// A bug in Qt means the wheel_scroll_lines setting gets ignored and replaced
// with the default value of 3 in QApplicationPrivate::initialize.
{