MCPcopy Create free account
hub / github.com/LUX-Core/lux / findStartupItemInList

Function findStartupItemInList

src/qt/guiutil.cpp:790–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788
789LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
790LSSharedFileListItemRef 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, &currentItemURL, NULL);
805#endif
806#else
807 LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, 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
822bool GetStartOnSystemStartup()
823{

Callers 2

GetStartOnSystemStartupFunction · 0.85
SetStartOnSystemStartupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected