summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstandardpaths_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qstandardpaths_mac.mm')
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm41
1 files changed, 8 insertions, 33 deletions
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index f08a6dac53..a293d4862f 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -117,7 +117,7 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type,
case QStandardPaths::TempLocation:
path = QDir::tempPath();
break;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
// These locations point to non-existing write-protected paths. Use sensible fallbacks.
case QStandardPaths::MusicLocation:
path = pathForDirectory(NSDocumentDirectory, mask) + QLatin1String("/Music");
@@ -168,43 +168,18 @@ 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)
{
QStringList dirs;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
if (type == PicturesLocation)
dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://");
#endif
@@ -230,13 +205,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (mainBundle) {
CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
CFStringRef cfBundlePath = CFURLCopyPath(bundleUrl);
- QString bundlePath = QCFString::toQString(cfBundlePath);
+ QString bundlePath = QString::fromCFString(cfBundlePath);
CFRelease(cfBundlePath);
CFRelease(bundleUrl);
CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl);
- QString resourcesPath = QCFString::toQString(cfResourcesPath);
+ QString resourcesPath = QString::fromCFString(cfResourcesPath);
CFRelease(cfResourcesPath);
CFRelease(resourcesUrl);