Re: NSWorkspaceRecycleOperation and auto-renaming items moved to Trash
Re: NSWorkspaceRecycleOperation and auto-renaming items moved to Trash
- Subject: Re: NSWorkspaceRecycleOperation and auto-renaming items moved to Trash
- From: Kurt Revis <email@hidden>
- Date: Sun, 24 Feb 2002 15:33:27 -0800
Kurt Revis (KR) wrote at Fri, 22 Feb 2002 17:19:40 -0800:
KR> The best way is to
KR> send an AppleEvent to the Finder to tell it to move the files to the
KR> trash itself
Wrong, wrong, wrong!!!!
Oh, give me a break.
Finder might not be there at all (it is not in my machine, for example).
Quite honestly, I am not too worried about annoying the 0.1% of users
who might have disabled the Finder for some reason. (Because they're
going to be equally annoyed by lots of other software, too...)
That's why there is NSWorkspace protocol -- to isolate the actual way
how it
is done from the API you use to ask for doing that!
If NSWorkspace is one of those many things OSX broke, well, fill a bug
so as
it is fixed, but please DON'T advocate using such a shortcuts instead
of the
proper abstract way :(
As I said, I did file a bug. (Not that I expect much--I don't have the
impression that Apple has traditionally been very fast about fixing
NSWorkspace bugs.) But since I want my software to work right now, I
need to do a workaround--and workarounds generally involve breaking some
abstraction.
In this case, my alternatives are:
1) Send an AppleEvent to the Finder to delete the files.
2) Find the appropriate Trash folder for each file (this may be the
user's ~/.Trash folder, may be somewhere else--I don't know all the
details for AppleShare or NFS or SMB or who-knows-what-else volumes).
Move the file there, making sure to change its name if there is already
a file there, without screwing up the file's extension or
extension-hidden flags (or any other flags, for that matter). Somehow
get the Dock to update its Trash icon. (Oh, by the way, can you please
explain to me a workaround to get the Dock to update the Trash icon
after I move something into it? If you can, I'll be happy to use it,
but I don't know of one.)
In the real world, alternative #1 seems a whole lot more expedient,
easier, and in fact more abstract and less likely to break in the
future. (In fact, I bet it's the currently recommended approach for
Carbon apps.) What do you think?
--
Kurt Revis
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.