QSettings: undo unintentional change of config dir on non-XDG platforms.
c99dfd8f63
only meant to be able to switch to the test mode of
QStandardPaths, not to move the default dir on OS X, iOS, BB10 and Android.
So this commit restores it to the previous behavior, to avoid migration issues.
The use of XDG_CONFIG_HOME, defaulting to ~/.config, on OS X, is even documented
in the current QSettings documentation, even though these paths are non-standard
on OS X (granted, the use of ini-style config files isn't either).
Task-number: QTBUG-41461
Change-Id: I5eb610ff7ccbdaf6f955ef7f8f7c2658cbecbb86
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
38c39341b3
commit
955c9562bd
@ -100,6 +100,10 @@ using namespace ABI::Windows::Storage;
|
||||
#define CSIDL_APPDATA 0x001a // <username>\Application Data
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID)
|
||||
#define Q_XDG_PLATFORM
|
||||
#endif
|
||||
|
||||
// ************************************************************************
|
||||
// QConfFile
|
||||
|
||||
@ -1041,7 +1045,9 @@ static void initDefaultPaths(QMutexLocker *locker)
|
||||
windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator());
|
||||
#else
|
||||
|
||||
#ifdef QT_NO_STANDARDPATHS
|
||||
#if defined(QT_NO_STANDARDPATHS) || !defined(Q_XDG_PLATFORM)
|
||||
// Non XDG platforms (OS X, iOS, Blackberry, Android...) have used this code path erroneously
|
||||
// for some time now. Moving away from that would require migrating existing settings.
|
||||
QString userPath;
|
||||
char *env = getenv("XDG_CONFIG_HOME");
|
||||
if (env == 0) {
|
||||
@ -1056,6 +1062,9 @@ static void initDefaultPaths(QMutexLocker *locker)
|
||||
userPath += QFile::decodeName(env);
|
||||
}
|
||||
#else
|
||||
// When using a proper XDG platform, use QStandardPaths rather than the above hand-written code;
|
||||
// it makes the use of test mode from unit tests possible.
|
||||
// Ideally all platforms should use this, but see above for the migration issue.
|
||||
QString userPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
||||
#endif
|
||||
userPath += QLatin1Char('/');
|
||||
|
Loading…
Reference in New Issue
Block a user