From 652f38ac8411b93f63a502e0698dbc6e186a1dda Mon Sep 17 00:00:00 2001 From: Andreas Muttscheller Date: Sun, 26 Feb 2017 11:20:10 +0100 Subject: [PATCH] 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 --- src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0964a2031..047130052 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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. {