1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-21 03:06:34 +01:00

[Windows] Use %APPDATA% for PROFILEDIR

Also show warning message when using deprecated config path ~/.qupzilla
This commit is contained in:
nowrep 2014-02-11 09:40:47 +01:00
parent 35fb5cecad
commit c1293fca3f

View File

@ -75,6 +75,8 @@
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include "qwebkitversion.h" #include "qwebkitversion.h"
#else
#include <QStandardPaths>
#endif #endif
MainApplication::MainApplication(int &argc, char** argv) MainApplication::MainApplication(int &argc, char** argv)
@ -194,17 +196,39 @@ MainApplication::MainApplication(int &argc, char** argv)
PROFILEDIR = DATADIR + "profiles/"; PROFILEDIR = DATADIR + "profiles/";
} }
else { else {
bool confPathExists = QDir(QDir::homePath() + "/.config/qupzilla").exists(); #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
bool homePathExists = QDir(QDir::homePath() + "/.qupzilla").exists(); // Use %APPDATA%/qupzilla as PROFILEDIR on Windows
#if QT_VERSION >= 0x050000
QString dataLocation = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#endif
if (dataLocation.isEmpty()) {
dataLocation = QDir::homePath() + QLatin1String("/.config/qupzilla/");
}
if (homePathExists && !confPathExists) { QDir confPath = QDir(dataLocation);
PROFILEDIR = QDir::homePath() + "/.qupzilla/"; #else // Unix
QDir confPath = QDir(QDir::homePath() + QLatin1String("/.config/qupzilla/"));
#endif
QDir homePath = QDir(QDir::homePath() + QLatin1String("/.qupzilla/"));
if (homePath.exists() && !confPath.exists()) {
PROFILEDIR = homePath.absolutePath() + QLatin1Char('/');
qWarning() << "WARNING: Using deprecated configuration path" << homePath.absolutePath();
qWarning() << "WARNING: This path may not be supported in future versions!";
qWarning() << "WARNING: Please move your configuration into" << confPath.absolutePath();
} }
else { else {
PROFILEDIR = QDir::homePath() + "/.config/qupzilla/"; PROFILEDIR = confPath.absolutePath() + QLatin1Char('/');
} }
} }
// Make sure the path exists
QDir dir;
dir.mkpath(PROFILEDIR);
TRANSLATIONSDIR = DATADIR + "locale/"; TRANSLATIONSDIR = DATADIR + "locale/";
THEMESDIR = DATADIR + "themes/"; THEMESDIR = DATADIR + "themes/";