Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions LaunchAtLoginController.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,24 @@ - (LSSharedFileListItemRef) findItemWithURL: (NSURL*) wantedURL inFileList: (LSS
if (wantedURL == NULL || fileList == NULL)
return NULL;

NSArray *listSnapshot = [NSMakeCollectable(LSSharedFileListCopySnapshot(fileList, NULL)) autorelease];
for (id itemObject in listSnapshot) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef) itemObject;
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(fileList, NULL);
for (id itemObject in (__bridge NSArray *)listSnapshot) {
LSSharedFileListItemRef item = (__bridge LSSharedFileListItemRef) itemObject;
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
CFURLRef currentItemURL = NULL;
LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, NULL);
if (currentItemURL && CFEqual(currentItemURL, wantedURL)) {
if (currentItemURL && CFEqual(currentItemURL, (__bridge CFTypeRef)(wantedURL))) {
CFRelease(currentItemURL);
CFRelease(listSnapshot);
return item;
}
if (currentItemURL)
CFRelease(currentItemURL);
}

if (listSnapshot)
CFRelease(listSnapshot);

return NULL;
}

Expand Down