• 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: Updating the trash icon without NSWorkspace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating the trash icon without NSWorkspace


  • Subject: Re: Updating the trash icon without NSWorkspace
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 4 Feb 2008 10:57:11 +0000

I'm not sure this is the best approach, but you could continue to use NSWorkspace and a combination of Aliases of FSRef:

1. Create an FSRef to the file. (or an Alias, but I think for your case an FSRef is better)
2. Use NSWorkspace to move it to the trash.


At undo-time, FSRef should be able to locate the file within the trash regardless of its new filename and you can then move it back out.

Mike.

On 4 Feb 2008, at 10:04, Lachlan Cotter wrote:

Hi Cocoabuilders,




I know there have been similar threads on here before, but they don't address my particular issue.


I'm using NSFileManager methods to move files into the trash. As has been mentioned by others, this doesn't update the trash icon in the doc.

I know I could use the NSWorkspace method performFileOperation… but the catch is I want to be able to undo the move, which means I would need to know the path to which the file was moved. However NSWorkspace may rename the file to prevent collisions. If this is the case, I wont have any way to find the new path to the file (other than guessing).

There are probably tricks that could be used to get this to work, but I wonder if there isn't a simple notification that can be raised to cause the trash icon to update?

In any case, I would also need to update it when taking files out of the trash, in which case NSWorkspace is no help.

Who manages this icon? Is it the Finder? or the Doc? Is there an API that can help here?

Thanks for your help.




Cheers, Lach_______________________________________________

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: Updating the trash icon without NSWorkspace
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Updating the trash icon without NSWorkspace (From: Lachlan Cotter <email@hidden>)

  • Prev by Date: Updating the trash icon without NSWorkspace
  • Next by Date: Re: Updating the trash icon without NSWorkspace
  • Previous by thread: Updating the trash icon without NSWorkspace
  • Next by thread: Re: Updating the trash icon without NSWorkspace
  • Index(es):
    • Date
    • Thread