Is there an API (carbon or cocoa) to determine if an item is in the trash?
NSFileManager, NSFileHandle and carbon Files.h do not have anything.

Or do I just do a path search looking for ".trash"?

You definitely do *not* do that. The name and location of the trash directory is an 
implementation detail that you shouldn't and needn't rely on. It's not ".trash" 
regardless. To date, the location of the trash on the volume containing the user's home 
directory is ~/.Trash and the location on all other volumes that have a trash at all is 
/Volumes/mount_point/.Trashes/`id -u` but that could change without notice.

In recent OS versions, you can use NSFileManager to get the URLs for mounted 
volumes and then loop over them using:

NSURL* u = [fm URLForDirectory:NSTrashDirectory 
inDomain:NSUserDomainMask appropriateForURL:mountPointURL create:YES 
error:&error];

Note that if you pass NO for the create argument and the trash directory 
doesn't exist you'll get back nil which may or may not be useful for your needs.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to