From d7a93c74aa352fa4eb370f4644d2c9d4b5b9a364 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 25 Mar 2013 14:57:34 +0100 Subject: [PATCH] OS X: Fix creation of Finder Favorite --- src/mirall/utility.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp index fc8b6bd999..675afa83d8 100644 --- a/src/mirall/utility.cpp +++ b/src/mirall/utility.cpp @@ -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(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);