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>bb10
parent
2c00943da0
commit
827232a74d
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue