나는 (맥) OS X의 시스템에 설치된 모든 응용 프로그램, LaunchServices에 등록 즉, 모든 응용 프로그램 번들을 열거하는 솔루션을 찾고 있어요
기본 문제. 열거 설치된 모든 응용 프로그램
작동하지 않았다
간단한 방법 (참고 : lsregister
이 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
에서 찾을 수 있습니다). 현재 내가 몇 가지 문제가 lsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*'
의 출력, 사용하고
: 올바르게 처리되지 않습니다 (UNIX에서만 유효 \n
)
.app
번들 줄 바꿈과을 (이 문제는 서면으로 고칠 것 적절한 파서)lsregister
은 이상한 파일명 (예 : RTL mark 포함)을 올바르게 처리하지 못합니다.lsregister
은 RTL 마크가있는 파일을 무시하는 것 같습니다. 원하는 경우 다음 명령을 실행하여 이름에 RTL이있는 파일을 만들 수 있습니다.python -c 'import shutil; shutil.copytree(u"/Applications/TextEdit.app", u"/Applications/ThisIsAWeird\u202EApp.app")'
이 작업을 수행 한 후,
lsregister -dump | grep ThisIsAWeird
는 를 공개하지 것입니다. 그러나 텍스트 파일을 마우스 오른쪽 버튼으로 클릭하고 "연결 프로그램"으로 이동하면 LaunchServices와 Finder가 해당 파일을 계속 지원합니다.
단순히 /Applications
에있는 모든 파일을 열거하고 LaunchServices 임의의 폴더에 응용 프로그램 번들 알고 나는 이러한 애플 리케이션을 필요로하기 때문에 다른 디렉토리가 작동하지 않습니다.
일을하지 않았다
다른 approch, 나는 할 필요가 정확히 않는 _LSFindApplications
라는 개인 API 함수있다 하지만 난 그게 동작하지 않습니다 어떤을 찾을 수 없습니다 인터넷상의 비공식 문서. (증거가 존재합니다 nm /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices | grep __LSFindApplications$
를)
UPDATE : lsregister
여전히 더 집어 들고 있음을 system_profiler 방법은 내가하지만 오늘은 발견 @Anoop에 의해 제안으로 system_profiler
방법은 작품 불구하고 지금까지
를 작동하지 않는 것 바이너리. 일부 또는 모든 컴퓨터에서 누락 된 일부는 system_profiler
에 누락 된 것 같습니다. 다른 볼륨에 OS X을 설치하면 외장 볼륨이 누락되었을 수 있습니다. 다음은 system_profiler
의 출력에서 누락 된 목록입니다 (단, lsregister
에 있음). 기계 :
/Applications/Automator.app/Contents/Resources/Application Stub.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/app_mode_loader.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/crash_report_sender.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper EH.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper NP.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper.app
/System/Library/CoreServices/AddPrinter.app
/System/Library/CoreServices/AirPlayUIAgent.app
/System/Library/CoreServices/AppleFileServer.app
/System/Library/CoreServices/AppleGraphicsWarning.app
/System/Library/CoreServices/AppleScript Runner.app
/System/Library/CoreServices/AppleScript Utility.app
/System/Library/CoreServices/CalendarFileHandler.app
/System/Library/CoreServices/Certificate Assistant.app
/System/Library/CoreServices/CoreLocationAgent.app
/System/Library/CoreServices/CoreServicesUIAgent.app
/System/Library/CoreServices/CoreTypes.bundle
/System/Library/CoreServices/Database Events.app
/System/Library/CoreServices/DiskImageMounter.app
/System/Library/CoreServices/Expansion Slot Utility.app
/System/Library/CoreServices/File Sync.app
/System/Library/CoreServices/FileSyncAgent.app
/System/Library/CoreServices/Folder Actions Dispatcher.app
/System/Library/CoreServices/Folder Actions Setup.app
/System/Library/CoreServices/HelpViewer.app
/System/Library/CoreServices/Image Events.app
/System/Library/CoreServices/Install in Progress.app
/System/Library/CoreServices/Jar Launcher.app
/System/Library/CoreServices/Java Web Start.app
/System/Library/CoreServices/KeyboardSetupAssistant.app
/System/Library/CoreServices/Language Chooser.app
/System/Library/CoreServices/LocationMenu.app
/System/Library/CoreServices/MRTAgent.app
/System/Library/CoreServices/Memory Slot Utility.app
/System/Library/CoreServices/NetAuthAgent.app
/System/Library/CoreServices/Network Diagnostics.app
/System/Library/CoreServices/Network Setup Assistant.app
/System/Library/CoreServices/ODSAgent.app
/System/Library/CoreServices/Pass Viewer.app
/System/Library/CoreServices/Printer Setup Utility.app
/System/Library/CoreServices/RegisterPluginIMApp.app
/System/Library/CoreServices/Screen Sharing.app
/System/Library/CoreServices/SecurityAgent.app
/System/Library/CoreServices/SecurityFixer.app
/System/Library/CoreServices/SocialPushAgent.app
/System/Library/CoreServices/System Events.app
/System/Library/CoreServices/System Image Utility.app
/System/Library/CoreServices/SystemUIServer.app
/System/Library/CoreServices/Ticket Viewer.app
/System/Library/CoreServices/UniversalAccessControl.app
/System/Library/CoreServices/UnmountAssistantAgent.app
/System/Library/CoreServices/UserNotificationCenter.app
/System/Library/CoreServices/VoiceOver.app
/System/Library/CoreServices/ZoomWindow.app
/System/Library/CoreServices/backupd.bundle/Contents/Resources/TMLaunchAgent.app
/System/Library/CoreServices/loginwindow.app
/System/Library/CoreServices/rcd.app
/System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app
/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuickLookUI.framework/Versions/A/Resources/QuickLookUIHelper.app
/System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app
/System/Library/PrivateFrameworks/DiskImages.framework/Versions/A/Resources/DiskImages UI Agent.app
/System/Library/Services/AppleSpell.service
/System/Library/Services/ChineseTextConverterService.app
/System/Library/Services/ImageCaptureService.app
/System/Library/Services/OpenSpell.service
/System/Library/Services/SpeechService.service
/System/Library/SocialServices/Facebook.socialplugin
/System/Library/SocialServices/Twitter.socialplugin
/System/Library/SocialServices/Weibo.socialplugin
RCDefaultApp을 사용하기 때문에이 방법이 가능하다는 것을 알고 있습니다.하지만 어떻게해야할지 모르겠습니다. – zneak