Question

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.

Was it helpful?

Solution 2

Why not simply...

set myPath to path to application "iPhoto"

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top