Re: Confusion over FSMoveObjectToTrashSync docs
Re: Confusion over FSMoveObjectToTrashSync docs
- Subject: Re: Confusion over FSMoveObjectToTrashSync docs
- From: Mark Allan <email@hidden>
- Date: Thu, 7 Aug 2008 21:23:18 +0100
Which "options" argument are you talking about? I just do the
following and it works as advertised.
[[NSWorkspace sharedWorkspace]
performFileOperation:NSWorkspaceRecycleOperation
source:parentDirOfFile destination:@"" files:[NSArray
arrayWithObject:@"fileName"] tag:nil]
The only slightly irritating bit is that you have to supply the file
name and the parent directory. You can't just pass it a path for
some reason.
Keep destination as the empty string (not nil) and your file will be
renamed as required when it hits the trash.
Mark
At 3:12 pm -0500 07/08/2008, Nate Weaver wrote:
I'd say just try the default options and see what happens. You might
also look at -[NSWorkspace
performFileOperation:source:destination:files:tag:] with
NSWorkspaceRecycleOperation as the first argument.
On Aug 7, 2008, at 2:03 PM, Randall Meadows wrote:
The description for FSMoveObjectToTrashSync says: "This function
moves a file or directory to the Trash, adjusting the object's name
if necessary." (Meaning, I suppose, it appends a number to the
filename to make it unique in the Trash directory.)
Lovely, *exactly* what I need to do. Happy happy, joy joy!
However, when I get into actually writing the code, I get to the
"options" argument, which are described as:
"kFSFileOperationDefaultOptions
Use the following default options:
*If the destination directory contains an object with the same name
as a source object, abort the operation.
kFSFileOperationOverwrite
If the destination directory contains an object with the same name
as a source object, overwrite the destination object."
Um, what happened to that part about "adjusting the object's name
if necessary"? According to the options flags, that is not
possible; it's either abort the operation or overwrite.
Anyone know the skinny on this actually works? The way I want to
use this function is to move a file that resides in a document
bundle into the Trash directory that resides on the same volume as
the document bundle (and yes, I understand that not all volumes
support Trash folders, I can handle 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