Fat Cat Software

iPhoto Library Manager and Leopard

I just thought I would drop a quick note regarding plans for Leopard compatibility for iPhoto Library Manager. The short version is that iPhoto Library Manager will support Leopard fully by the time Leopard comes out. Yay! Since things can change and break things at the last minute with new OS releases, I won't actually be releasing a Leopard compatible version of iPLM until I can actually test it with the final version of Leopard, but I've got the big stuff figured out already. For those interested in the nerdy technical details, read onward.Leopard will require some changes in the way iPhoto Library Manager works under the hood. iPLM uses the Input Manager mechanism of Mac OS X to load a bundle of code into iPhoto which supplements iPhoto's Applescripting capabilities, which is what makes features such as copying albums and merging libraries possible. Some other programs, such as Inquisitor and 1Passwd also use input managers to implement their functionality. However, as has been reported by Ars Technica and discussed on some other blogs, input managers are no longer going to be supported under Leopard.Other developers have found other methods to do what they need to do under Leopard, such as 1Passwd, whose developers say they are going to switch to a WebKit plugin, which works well for them since their product is web browser oriented. iPhoto Library Manager is going to take a different approach though.One difference between iPLM and some other apps that use input managers is that iPLM only actually needs its code to be loaded when it's actively doing something with iPhoto, like copying some albums between libraries. It doesn't matter if the code is loaded every time iPhoto is launched, unlike say, Inquisitor, which pretty much always has to be there to be of any use.So, instead of a plugin based approach, under Leopard iPLM will use a handy little feature of the OS X dynamic linker, the DYLD_INSERT_LIBRARIES environment variable. Basically what this does is allow you to load additional dynamic libraries in an application (and even substitute for libraries the application is already linked to). The most well known usage for this feature is the MallocDebug developer application, which loads a custom debug version of the malloc library that replaces the normal system library and provides all sort of information on memory usage in the application being debugged.The downside to this approach is that it requires relaunching the application in question in order to load the additional code, since you have to set up this environment variable and then launch the application yourself. So, for something like Inquisitor, launching Safari directly from the dock would not load the code automatically. There would have to be a separate program that performs the special setup and launch Safari itself, which would be a pain in the butt for users. However, this isn't really a problem for iPLM, since it has to relaunch iPhoto multiple times during an album copy anyway, so having to do the special setup doesn't really change the flow of things at all.There are a couple other upsides to this approach:The code will only be loaded into iPhoto itself, unlike input managers, which load their code into any Cocoa application that runs. iPLM's code doesn't actually do anything unless it's being loaded in iPhoto, but the input manager bundle still shows up in crash reports and such, which can be suspicious to others trying to debug a crash.Nothing needs to be installed! All the code can sit happily within iPLM's application bundle, and there's no need to update the bundle when iPLM is updated, or any of that hassle. This means I'll actually be deleting more code than I'm writing in order to change to the new method.The only feature that will be lost as a result of the change is putting the name of the current library in the title bar of the iPhoto window itself. This was a neat addition that I put in on a whim, but since the iPLM code will no longer always be running in iPhoto, this will be going away.In retrospect, if I had known about this method of doing things back when I first wrote iPLM 3.0, I probably would have done it this way in the first place, since it's less intrusive and uses a long standing feature of dyld that isn't likely to go anywhere anytime soon. Like I said above, this method isn't feasible for many programs that are currently using input managers, but this may still prove a useful technique to some other programs transitioning over to Leopard.