• 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: Charles Srstka <email@hidden>
  • Date: Sat, 12 Jul 2008 11:49:54 -0500

On Jul 12, 2008, at 2:25 AM, Ruotger Skupin wrote:

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?

He's not referring to making an alias *file*, just an alias in memory. To do that, you make an FSRef first as I described, then you use FSNewAlias() with NULL as the first argument, a pointer to your FSRef as the second argument, and a pointer to an AliasHandle as the third argument. Later, you can use FSResolveAlias() to get the FSRef back, and then you resolve the FSRef into a file path.


The advantage is, as Gregory mentioned, that you can store the alias in your preferences (after encoding it to an NSData or something) and load it back again the next time your program launches. I also think FSRefs don't stay valid if the disk that the file is on gets ejected, although I may be wrong about that one. My guess is that Undo support doesn't really need to persist across program launches, so in my opinion you'd be fine with an FSRef, although doing a little extra work and getting an AliasHandle wouldn't really hurt anything. It's up to you, I guess.

Charles
_______________________________________________

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: "Sean McBride" <email@hidden>
References: 
 >Re: Trashing files and undo (From: Gregory Weston <email@hidden>)
 >Re: Trashing files and undo (From: Ruotger Skupin <email@hidden>)

  • Prev by Date: Re: how to get the status of network when the network is set disable.
  • Next by Date: Re: garbage collection and NSConnection
  • Previous by thread: Re: Trashing files and undo
  • Next by thread: Re: Trashing files and undo
  • Index(es):
    • Date
    • Thread