• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trashing files and undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trashing files and undo


  • Subject: Re: Trashing files and undo
  • From: Ruotger Skupin <email@hidden>
  • Date: Sat, 12 Jul 2008 09:25:40 +0200

Hi,

if I get you right, you are suggesting I put an alias to the file into (say) ~/Library/Application Support/MyApp/UndoAliases/ remember the original path/filename then trash the file. To get it back I resolve the alias and move/rename it.

What's the advantage over the FSRef solution Charles proposed?

Ruotger

Am 11.07.2008 um 17:44 schrieb Gregory Weston:

Ruotger Skupin wrote:

my app trashes files with -[NSWorkspace
performFileOperation:source:destination:files:tag:] and
NSWorkspaceRecycleOperation. This works flawlessly but users want undo.


NSWorkspace does not seem to allow undoing said file operation (or any
file operation for that matter). Correct me if I'm wrong.


So I might have to figure out where the trash directory for a given
volume/user/file etc is and move it myself. Is there an easy way to
find that out?

Drop-dead simple. FSFindFolder is your friend. Give it a volume reference number and tell it you're looking for the user's trash and it'll hand it back to you (creating it if necessary and you asked for that behavior).


I think possibly a bigger issue here is going to be that moving files to the trash can cause them to be renamed. At least doing so in Finder can; I'm not sure if the NSWorkspace routine does the same. You'll need a reliable way to track the file and map that back to the original location and name. You'll want to look at aliases for that.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Trashing files and undo
      • From: Charles Srstka <email@hidden>
    • Re: Trashing files and undo
      • From: Gregory Weston <email@hidden>
    • Re: Trashing files and undo
      • From: Gregory Weston <email@hidden>
References: 
 >Re: Trashing files and undo (From: Gregory Weston <email@hidden>)

  • Prev by Date: Re: Trashing files and undo
  • Next by Date: Re: Trashing files and undo
  • Previous by thread: Re: Trashing files and undo
  • Next by thread: Re: Trashing files and undo
  • Index(es):
    • Date
    • Thread