diff options
author | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-04-10 10:58:54 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-05-05 06:20:10 +0000 |
commit | 827232a74d0910252df1ea226d4db54c3a029568 (patch) | |
tree | 64ad8ccee1fb49281d6233ca682dfab43184d5c8 /src/corelib/io | |
parent | 2c00943da02064e776cac9b1fad6a33958ff0a3e (diff) |
qstandardpaths_ios: return writable locations for Fonts, Music, Movies, Pictures and Download
QStandardPaths::writableLocation() for FontsLocation, MusicLocation,
MoviesLocation, PicturesLocation and DownloadLocation all return directories
that point inside the sandbox, but don't exist and cannot be created. In
other words, they are not usable for writing or anything else. According to
iOS File System Programming Guide (*), such files should instead be located
inside Documents, or sub-directories within.
(*) https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW4
Task-number: QTBUG-42804
Change-Id: I54145af8058d68e0346d29de5a2bec18dafc21e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qstandardpaths_ios.mm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/io/qstandardpaths_ios.mm b/src/corelib/io/qstandardpaths_ios.mm index 27d28526c2..4af1d93589 100644 --- a/src/corelib/io/qstandardpaths_ios.mm +++ b/src/corelib/io/qstandardpaths_ios.mm @@ -62,19 +62,22 @@ QString QStandardPaths::writableLocation(StandardLocation type) location = pathForDirectory(NSDocumentDirectory); break; case FontsLocation: - location = bundlePath() + QLatin1String("/.fonts"); + location = pathForDirectory(NSDocumentDirectory) + QLatin1String("/.fonts"); break; case ApplicationsLocation: location = pathForDirectory(NSApplicationDirectory); break; case MusicLocation: - location = pathForDirectory(NSMusicDirectory); + // NSMusicDirectory points to a non-existing write-protected path. Use sensible fallback. + location = pathForDirectory(NSDocumentDirectory) + QLatin1String("/Music"); break; case MoviesLocation: - location = pathForDirectory(NSMoviesDirectory); + // NSMoviesDirectory points to a non-existing write-protected path. Use sensible fallback. + location = pathForDirectory(NSDocumentDirectory) + QLatin1String("/Movies"); break; case PicturesLocation: - location = pathForDirectory(NSPicturesDirectory); + // NSPicturesDirectory points to a non-existing write-protected path. Use sensible fallback. + location = pathForDirectory(NSDocumentDirectory) + QLatin1String("/Pictures"); break; case TempLocation: location = QString::fromNSString(NSTemporaryDirectory()); @@ -99,7 +102,8 @@ QString QStandardPaths::writableLocation(StandardLocation type) location = pathForDirectory(NSDocumentDirectory); break; case DownloadLocation: - location = pathForDirectory(NSDownloadsDirectory); + // NSDownloadsDirectory points to a non-existing write-protected path. + location = pathForDirectory(NSDocumentDirectory) + QLatin1String("/Download"); break; default: break; |