path: root/src/corelib/io/
diff options
authorSamuel Gaist <>2016-01-04 17:56:05 +0100
committerSamuel Gaist <>2016-02-15 14:22:14 +0000
commit018e670a26ff5a61b949100ae080f5e654e7bee8 (patch)
tree6573675f89423ac9edc0f0941e2781657ebff101 /src/corelib/io/
parentc689bcafd3196aad22372e8056fe0ccb13c15f35 (diff)
OS X: Implement download folder display name query
Up to now, the download folder display name was queried using FSFindFolder and kDesktopFolderType. Now that NSFileManager can be used unconditionnaly, the query has been replaced to use NSFileManager. [ChangeLog][QtCore][OS X] QStandardPaths now returns the correct display name for the download folder. Task-number: QTBUG-50262 Change-Id: Ie16c8daea3261a4dd5ca051956fc08d51656e0fa Reviewed-by: Jake Petroules <>
Diffstat (limited to 'src/corelib/io/')
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/io/ b/src/corelib/io/
index 7b97a03db2..f65ca2048a 100644
--- a/src/corelib/io/
+++ b/src/corelib/io/
@@ -229,6 +229,14 @@ QString QStandardPaths::displayName(StandardLocation type)
if (QStandardPaths::HomeLocation == type)
return QCoreApplication::translate("QStandardPaths", "Home");
+ if (QStandardPaths::DownloadLocation == type) {
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSURL *url = [fileManager URLForDirectory:NSDownloadsDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
+ if (!url)
+ return QString();
+ return QString::fromNSString([fileManager displayNameAtPath: [url absoluteString]]);
+ }
FSRef ref;
OSErr err = FSFindFolder(kOnAppropriateDisk, translateLocation(type), false, &ref);
if (err)