MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / findStartupItemInList

Function findStartupItemInList

src/qt/guiutil.cpp:693–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691
692LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
693LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
694{
695 CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, nullptr);
696 if (listSnapshot == nullptr) {
697 return nullptr;
698 }
699
700 // loop through the list of startup items and try to find the bitcoin app
701 for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
702 LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
703 UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
704 CFURLRef currentItemURL = nullptr;
705
706#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100
707 if(&LSSharedFileListItemCopyResolvedURL)
708 currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, nullptr);
709#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 10100
710 else
711 LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr);
712#endif
713#else
714 LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr);
715#endif
716
717 if(currentItemURL) {
718 if (CFEqual(currentItemURL, findUrl)) {
719 // found
720 CFRelease(listSnapshot);
721 CFRelease(currentItemURL);
722 return item;
723 }
724 CFRelease(currentItemURL);
725 }
726 }
727
728 CFRelease(listSnapshot);
729 return nullptr;
730}
731
732bool GetStartOnSystemStartup()
733{

Callers 2

GetStartOnSystemStartupFunction · 0.85
SetStartOnSystemStartupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected