Move a file to the Trash
Move a file to the Trash
- Subject: Move a file to the Trash
- From: Lorenzo Puleo <email@hidden>
- Date: Wed, 06 Nov 2002 11:08:32 +0100
Hi,
is someone that can suggest me how to move a file to the trash properly?
Actually I use the APIs:
NSString *fileInTrash = [[NSHomeDirectory()
stringByAppendingPathComponent:@".Trash"]
stringByAppendingPathComponent:[myFile lastPathComponent]];
ok = [manager movePath:myFile toPath:fileInTrash handler:nil];
This guarantees that the file goes to the current user's trash. But this
works properly only if the file is placed on the X boot disk.
Instead, when I tried to trash a file placed on a disk that is NOT my boot
disk, that file has not been simply "moved" but "copied" to the trash in the
boot disk then deleted from the original disk. This could require a waste of
time.
Since my eternal disks have the invisible folder "Trash" placed in the root,
I thought that I should move any external file to:
/Volumes/ExternalDisk/Trash/myFile
But I am not sure this is the solution.
How to do this properly? Carbon API "FindFolder"?
Thanks for any asnwer, sample code for Cocoa, links to PDF files, tricks...
--
Lorenzo Puleo
mailto: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.