mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
OS X: Fix creation of Finder Favorite
This commit is contained in:
parent
408547611b
commit
d7a93c74aa
@ -56,16 +56,15 @@ void Utility::setupFavLink(const QString &folder)
|
||||
if (!QFile::link(folder, linkName))
|
||||
qDebug() << Q_FUNC_INFO << "linking" << folder << "to" << linkName << "failed!";
|
||||
#elif defined (Q_OS_MAC)
|
||||
// Finder: Place under "Places"
|
||||
QString folderUrl = QUrl::fromLocalFile(folder).toString();
|
||||
CFStringRef folderCFStr = CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(folderUrl.unicode()),
|
||||
folder.length());
|
||||
CFURLRef urlRef = CFURLCreateWithString(NULL, folderCFStr, 0);
|
||||
// Finder: Place under "Places"/"Favorites" on the left sidebar
|
||||
CFStringRef folderCFStr = CFStringCreateWithCString(0, folder.toUtf8().data(), kCFStringEncodingUTF8);
|
||||
CFURLRef urlRef = CFURLCreateWithFileSystemPath (0, folderCFStr, kCFURLPOSIXPathStyle, true);
|
||||
|
||||
LSSharedFileListRef placesItems = LSSharedFileListCreate(0, kLSSharedFileListFavoriteItems, 0);
|
||||
if (placesItems) {
|
||||
//Insert an item to the list.
|
||||
LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(placesItems,
|
||||
kLSSharedFileListItemBeforeFirst, 0, 0,
|
||||
kLSSharedFileListItemLast, 0, 0,
|
||||
urlRef, 0, 0);
|
||||
if (item)
|
||||
CFRelease(item);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user