Monday, October 3, 2005 [Tweets] [Favorites]

Aliases, Paths, and FSRefs

DrunkenBatman reports on an Apple engineer who, sadly, isn’t familiar with aliases. Preview tracks bookmarks using paths.

Meanwhile, Wil Shipley rightly doesn’t like the -applicationSupportFolder method in the CoreData stationery. But I guess someone should point out that FSRefMakePath is actually rather new, and that you can avoid fixed-sized buffers using CFURLCreateFromFSRef. Also, I do think his code should make sure the Application Support folder exists, and that it should also resolve any aliases in the resulting path.

My version of this method uses FSFindFolder (since NSApplicationSupportDirectory is only available in Tiger), and it will fall back on using a hard-coded path if FSFindFolder fails, which I’ve seen happen in the wild. It also fixes the permissions of the folder, if necessary, to make sure that I’ll be able to create files in it. Alas, it’s not one line of code.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment