|Home » Industry Watch » Coldspots
Apple! Put Back 'Put Back'
Certainly there are better ways of doing something so simple.
The ability to restore trashed files to their original locations is a feature long awaited on OS X. Certainly there are users who never use the trash - these people are the ones who do the Times crossword with an ink pen. Others like to have an easy way to dispense with files on a 'trial basis'. Endemic to such a facility is the ability to put the files back where they belong should the need arise.
Apple's implementation for OS X 10.6 Snow Leopard gives nearly nothing and leaves everything.
There have to be better ways of doing this. And there are.
0. 'The Beige Box Way'
A method bound to piss almost everybody off so it's good for a lark. Just make every mini-monster on the desktop capable of generating .DS_Store files willy-nilly all the time, at the slightest whim. Don't forget to glue com.apple.FinderInfo extended attributes on them too. And get rid of that flag that stops them from being crapped around LANs. That'll really frazzle 'em.
1. 'The Microsoft Way'
Microsoft's implementation of the 'recycle bin' is good. The recycle folders are under the jurisdiction of the 'shell' DLL and thereby Windows Explorer. Navigating the 'shell name space' means different 'views' can appear at different locations. In this particular case one need only establish a register/flat database (or perhaps even better a Cocoa dictionary) to house file serial numbers and original paths.
For display purposes the original file name (sans path) is given; to restore a given file, the shell need only pluck the original path corresponding to the selected item. Piece of cake.
2. With a Property List
If it can be done with a register the way Microsoft have done it then it can surely be done with a Cocoa property list as well. The file ~/Library/Preferences/com.apple.Trash.plist could contain the exact same thing as in the above example. And it could also be put in com.apple.desktop.plist (which already exists). Piece of cake.
Why Not Kill the Monster While You're At It
It's not much more difficult to kill off .DS_Store once and for all. As Arno Gourdol revealed several years ago, it was never the intention to let .DS_Store files litter a hard drive (or a network) - it was just another unfortunate bug that 'somehow' didn't get fixed in
eight ten years.
But what's .DS_Store good for? Except pissing people off? Spatiality - getting your cute lickable icons back at the same locations as the last time you saw them. [Don't laugh - for some users a slight misalignment can completely ruin the day.]
But do we want this 'spatiality' everywhere? No - the only place it's applicable is in the home area (~). You can't put spatiality anywhere else - not even /Applications. Those are shared areas. So how do you do it - without .DS_Store?
Easy. The same way you do everything else suggested in this article: you use a property list. Appropriately stored in ~/Library/Preferences. And there you store all possible settings for all possible directories/folders owned by the current user. Anything inside ~ and nothing without. Dock does this today for its inhabitants. Piece of cake.
Restoring files from a recycler (NeXTSTEP/OpenStep) or the recycle bin (Windows) or the trash (Mac) is an endemic file operation just as integral as putting files there in the first place. Cocoa of course has specific APIs for both permanently unlinking files and moving them to the trash. Consequently it should include the corresponding APIs for putting them back again. The way they're implemented in Snow Leopard shows something's still not right at Apple.
You can (with consummate patience) get Cupertino out of Beige Box Country but you have to work a lot harder to get Beige Box Country out of Cupertino.
The Technological: Arno Lives!!1!