1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

revert: "fix: Replace hardcored roaming path on QStandartPath"

Fix #4449
This reverts commit f616ff36b6.
This commit is contained in:
Diadlo 2017-06-10 09:51:17 +03:00
parent 6b3e03ca6a
commit d90a60bdf7
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 13 additions and 52 deletions

View File

@ -715,35 +715,21 @@ QString Settings::getSettingsDirPath() const
if (makeToxPortable)
return qApp->applicationDirPath() + QDir::separator();
QString path;
#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
// workaround for https://bugreports.qt-project.org/browse/QTBUG-38845
# ifdef Q_OS_WIN
#ifdef Q_OS_WIN
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "AppData" + QDir::separator() + "Roaming"
+ QDir::separator() + "tox")
+ QDir::separator();
# elif defined(Q_OS_OSX)
#elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "Library" + QDir::separator()
+ "Application Support" + QDir::separator() + "Tox")
+ QDir::separator();
# else
#else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ QDir::separator() + "tox")
+ QDir::separator();
# endif
#else
# ifdef Q_OS_WIN
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "tox") + QDir::separator();
# elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "Tox") + QDir::separator();
# else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ QDir::separator() + "tox") + QDir::separator();
# endif
#endif
}
@ -757,31 +743,25 @@ QString Settings::getAppDataDirPath() const
if (makeToxPortable)
return qApp->applicationDirPath() + QDir::separator();
#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
// workaround for https://bugreports.qt-project.org/browse/QTBUG-38845
# ifdef Q_OS_WIN
#ifdef Q_OS_WIN
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "AppData" + QDir::separator() + "Roaming"
+ QDir::separator() + "tox")
+ QDir::separator();
# elif defined(Q_OS_OSX)
#elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "Library" + QDir::separator()
+ "Application Support" + QDir::separator() + "Tox")
+ QDir::separator();
# else
#else
/*
* TODO: Change QStandardPaths::DataLocation to AppDataLocation when upgrate Qt to 5.4+
* For now we need support Qt 5.3, so we use deprecated DataLocation
* BTW, it's not a big deal since for linux AppDataLocation and DataLocation are equal
*/
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::DataLocation))
+ QDir::separator();
# endif
#else
# if defined(Q_OS_OSX)
# elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "Tox") + QDir::separator();
# else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "tox") + QDir::separator();
# endif
#endif
}
@ -795,33 +775,20 @@ QString Settings::getAppCacheDirPath() const
if (makeToxPortable)
return qApp->applicationDirPath() + QDir::separator();
#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
// workaround for https://bugreports.qt-project.org/browse/QTBUG-38845
# ifdef Q_OS_WIN
#ifdef Q_OS_WIN
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "AppData" + QDir::separator() + "Roaming"
+ QDir::separator() + "tox")
+ QDir::separator();
# elif defined(Q_OS_OSX)
#elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "Library" + QDir::separator()
+ "Application Support" + QDir::separator() + "Tox")
+ QDir::separator();
# else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
+ QDir::separator();
# endif
#else
# ifdef Q_OS_WIN
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "tox") + QDir::separator();
# elif defined(Q_OS_OSX)
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "Tox") + QDir::separator();
# else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
+ QDir::separator();
# endif
#endif
}

View File

@ -108,15 +108,9 @@ QString Settings::getSettingsDirPath() const
}
if (isOld) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QDir::separator() + "AppData" + QDir::separator() + "Roaming"
+ QDir::separator() + "tox" + QDir::separator());
#else
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QDir::separator() + "tox" + QDir::separator());
#endif
} else {
QString pathStr = QString::fromStdWString(path);
pathStr.replace("\\", "/");