Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Pix
Abi 2000
Stargate: Resurgence
Lost? Site Map!
 
 
     home | blog | moose | programming | articles >> blog

 Blog Topics
 
 Archive
 

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 
 iTunesCantComplain released
2011-10-28 @954
 
 Dennis Ritchie deceased
2011-10-13 @359
 
 Thank you, Steve.
2011-10-06 @374
 
 Cocoa Text System everywhere...
2011-03-27 @788
 
 Blog migration
2011-01-29 @520
 
 All you need to know about the Mac keyboard
2010-08-09 @488
 
 Review: Sherlock
2010-07-31 @978
 
 Playing with Objective C on Debian
2010-05-08 @456
 
 Fruit vs. Obst
2010-05-08 @439
 
 Mixed-language ambiguity
2010-04-15 @994
 
 Uli's 12:07 AM Law
2010-04-12 @881
 
 Uli's 1:24 AM Law
2010-04-12 @874
 
 Uli's 6:28 AM Law
2010-04-12 @869
 
 Uli's 3:57 PM Law
2010-04-12 @867
 

More...

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 ][ ;-)

Reader Comments: (RSS Feed)
No comments yet
Or E-Mail Uli privately.

 
Created: 2006-10-28 @025 Last change: 2006-10-28 @894 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.