diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-04 15:30:08 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2016-10-04 21:22:05 +0000 |
commit | f2b90b4e825bc0f1d2204add64241724a71af4da (patch) | |
tree | f6b6b966e6a209e8248f7f0ba20abf2b1304dabf /src/corelib/io/qstandardpaths_mac.mm | |
parent | 6c8f32388bc7c7228887560151cde8e6d96cc546 (diff) |
Apple OS: Resolve QStandardPaths test data locations based on real locations
Instead of the manual logic for computing test data locations, we use the
locations from baseWritableLocation, but make sure to put them all under
'.qttest' in the home directory. This approach handles more cases for test
data, and also plays nice with locations that are not in the home directory
due to being containerized (and hence do not need a separate test data scope).
Change-Id: Iea4f21acb75c0191be35a3619c05143e8929bd6e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/corelib/io/qstandardpaths_mac.mm')
-rw-r--r-- | src/corelib/io/qstandardpaths_mac.mm | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index dc3d7737b6..5aa894578b 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -168,36 +168,11 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type, QString QStandardPaths::writableLocation(StandardLocation type) { - if (isTestModeEnabled()) { - const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest"); - QString path; - switch (type) { - case GenericDataLocation: - case AppDataLocation: - case AppLocalDataLocation: - path = qttestDir + QLatin1String("/Application Support"); - if (type != GenericDataLocation) - appendOrganizationAndApp(path); - return path; - case GenericCacheLocation: - case CacheLocation: - path = qttestDir + QLatin1String("/Cache"); - if (type == CacheLocation) - appendOrganizationAndApp(path); - return path; - case GenericConfigLocation: - case ConfigLocation: - case AppConfigLocation: - path = qttestDir + QLatin1String("/Preferences"); - if (type == AppConfigLocation) - appendOrganizationAndApp(path); - return path; - default: - break; - } - } + QString location = baseWritableLocation(type, NSUserDomainMask, true); + if (isTestModeEnabled()) + location = location.replace(QDir::homePath(), QDir::homePath() + QLatin1String("/.qttest")); - return baseWritableLocation(type, NSUserDomainMask, true); + return location; } QStringList QStandardPaths::standardLocations(StandardLocation type) |