문제

One of my desktop apps I need to know where the iPhoto Library is installed, programmatically. I do not want to pick it from predicted location (/Users/me/Pictures/iPhoto) since power user may have installed it somewhere else.

I'm developing app using Python and I guess Applescript might have way to figure out iPhoto location but I don't know how.

도움이 되었습니까?

해결책 2

Why not simply...

set myPath to path to application "iPhoto"

다른 팁

One method is to use 'defaults'.

Applescript:

set lib_path to do shell script "defaults read com.apple.iphoto LibraryPath"

Should be similar way to do it straight from Python.

A downside to this is if Apple changes the format of iPhotos preference file in the future and it breaks.

Simply invoke the system command which iPhoto (assuming that you can run iPhoto from a shell) and parse the output.

[Removed LaunchServices-based answer as OP apparently wants the location of the iPhoto Library, not iPhoto itself.]

OP should look into Karelia's iMedia framework (dev forum), which includes iPhoto support. The Karelia crew have also done a lot of legwork in figuring out how to make it sandbox/AppStore-compatible, which may also be a consideration depending on how the OP plans to distribute the app.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top