Fix torrent file selection in Finder on mac

This commit is contained in:
vit9696
2017-12-12 18:00:56 +03:00
parent 84c84160fd
commit d57bd62add
3 changed files with 28 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
#include "macutilities.h"
#include <QSet>
#include <QtMac>
#include <objc/message.h>
#import <Cocoa/Cocoa.h>
@@ -81,3 +82,15 @@ void displayNotification(const QString &title, const QString &message)
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
}
}
void openFiles(const QSet<QString> &pathsList)
{
@autoreleasepool {
NSMutableArray *pathURLs = [NSMutableArray arrayWithCapacity:pathsList.size()];
for (const auto &path : pathsList)
[pathURLs addObject:[NSURL fileURLWithPath:path.toNSString()]];
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:pathURLs];
}
}