summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstandardpaths_mac.mm
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2016-01-04 17:56:05 +0100
committerSamuel Gaist <samuel.gaist@edeltech.ch>2016-02-15 14:22:14 +0000
commit018e670a26ff5a61b949100ae080f5e654e7bee8 (patch)
tree6573675f89423ac9edc0f0941e2781657ebff101 /src/corelib/io/qstandardpaths_mac.mm
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 <jake.petroules@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qstandardpaths_mac.mm')
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index 7b97a03db2..f65ca2048a 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -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)