| 788 | |
| 789 | LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl); |
| 790 | LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl) |
| 791 | { |
| 792 | // loop through the list of startup items and try to find the lux app |
| 793 | CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL); |
| 794 | for (int i = 0; i < CFArrayGetCount(listSnapshot); i++) { |
| 795 | LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i); |
| 796 | UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes; |
| 797 | CFURLRef currentItemURL = nullptr; |
| 798 | |
| 799 | #if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100 |
| 800 | if(&LSSharedFileListItemCopyResolvedURL) |
| 801 | currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL); |
| 802 | #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 10100 |
| 803 | else |
| 804 | LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL); |
| 805 | #endif |
| 806 | #else |
| 807 | LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL); |
| 808 | #endif |
| 809 | |
| 810 | if (currentItemURL && CFEqual(currentItemURL, findUrl)) { |
| 811 | // found |
| 812 | CFRelease(currentItemURL); |
| 813 | return item; |
| 814 | } |
| 815 | if (currentItemURL) { |
| 816 | CFRelease(currentItemURL); |
| 817 | } |
| 818 | } |
| 819 | return NULL; |
| 820 | } |
| 821 | |
| 822 | bool GetStartOnSystemStartup() |
| 823 | { |
no outgoing calls
no test coverage detected