Uli's Web Site
Why Aliases and Smart Folders won't change
For ages, Apple and others have told us not to manually create Alias files because their implementation may change at any time. Instead, the recommendation was to send an Apple Event to the Finder. Now, today, thinking about the file format of Finder's smart folders, I finally started questioning that statement and realized something:
Apple won't change the format of such files in a way that will break an app that creates them manually.
Why? Because files can be anywhere. A file can be on a network server or an external hard disk that was unmounted during the last system update. Thus, Finder and the system have to be prepared to get such an old file and either convert it (which would break other clients of this file, e.g. OS 9 mounting this volume), or it would have to be able to understand the unchanged file directly.
Of course, there are a few caveats: Any old-style file you write will still work, but you can't rely on being able to read such a file. Finder could have converted an Alias to a newer format, and removed the old 'alis' resource. It's not likely, but possible. If the Alias was newly-created, it may not contain an 'alis' resource at all.
In addition, you can't rely on Apple APIs to create the Alias. Apple may change OS X so an AliasHandle in RAM is Little-endian (it's supposed to be an opaque data structure, after all), while legacy code on disk would only know how to cope with a Big-endian 'alis' resource.
While the former is not too likely, as it will break backwards compatibility, and will royally annoy many of the IT departments Apple have been trying to lure in with the Xserve, the latter is a distinct possibility. On the other hand, if you're talking property list files, those are just text. You can probably just generate them from a fixed template with a few placeholders and be guaranteed that any smart folder you create will work and show up in Finder just fine.
Yeah, you're probably yawning right now, but it took me a while to realize this, and maybe others are as dense as me. Seize the day! Free yourself from the shackles of Apple's recommendations.
... I can't wait till the OS is a mess of tangled private APIs that have been hacked to run applications again, and Apple can't change a single thing, just like in the good old days of the Apple ][ ;-)
Created: 2006-10-28 @025 Last change: 2006-10-28 @894 | Home | Admin | Edit|
© Copyright 2003-2016 by M. Uli Kusterer, all rights reserved.