From 280a0eb27ee0f9661c44e9230f7f59b2551b18af Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 9 Jun 2013 16:41:45 +0200 Subject: Fix temporary files stored in current folder on first start. If Rockbox Utility has no configuration file on the machine updateSettings() will overwrite the global cache folder settings with an empty string before the value is set properly by the user confirming the configuration dialog. QDir() getting an empty string will result in the current working directory getting used, and thus the temporary files ending up there. On Windows most users are unlikely to have noticed this since running the executable from within the distribution zip file will make Windows execute it in the systems temporary path. Change-Id: I7724a82af403955786798c7380198086837e128f --- rbutil/rbutilqt/rbutilqt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 6ff80c3cc2..6703b08791 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -72,6 +72,8 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) absolutePath = qApp->applicationDirPath(); + QString c = RbSettings::value(RbSettings::CachePath).toString(); + HttpGet::setGlobalCache(c.isEmpty() ? QDir::tempPath() : c); HttpGet::setGlobalUserAgent("rbutil/"VERSION); HttpGet::setGlobalProxy(proxy()); // init startup & autodetection @@ -113,12 +115,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) #endif #if !defined(Q_OS_WIN32) && !defined(Q_OS_MACX) - /* eject funtionality is only implemented on W32 right now. */ + /* eject funtionality is not available on Linux right now. */ ui.buttonEject->setEnabled(false); #endif - QString c = RbSettings::value(RbSettings::CachePath).toString(); - if(c.isEmpty()) c = QDir::tempPath(); - HttpGet::setGlobalCache(c); updateDevice(); downloadInfo(); @@ -314,8 +313,9 @@ void RbUtilQt::updateSettings() qDebug() << "[RbUtil] updating current settings"; updateDevice(); manual->updateManual(); + QString c = RbSettings::value(RbSettings::CachePath).toString(); + HttpGet::setGlobalCache(c.isEmpty() ? QDir::tempPath() : c); HttpGet::setGlobalProxy(proxy()); - HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString()); if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) { QApplication::processEvents(); -- cgit v1.2.3