Re: NSFileManager movePath problem
Re: NSFileManager movePath problem
- Subject: Re: NSFileManager movePath problem
- From: Ricky Sharp <email@hidden>
- Date: Sat, 27 Jan 2007 13:25:39 -0600
On Jan 27, 2007, at 1:01 PM, email@hidden wrote:
My app needs to copy files from Mac workstations to Windows servers
and I'm finding that the auto generated name produced by
NSFileManager movePath:toPath: is returning the error
Error = "Couldn't create";
Path = "/Volumes/PMXData/Pagination/Documents/EEB9A911-AE33-11DB-
AE99-0016CBCA4065-5847-0000CDC4EB9542BB";
Further tests indicate that it's the length of the auto generated
name that's the issue. Is there a way to use NSFileManager but
force a user supplied name rather than having this temporary over
long auto generated one?
That's strange as a Windows volume should be able to handle such a
name. Strange though how that name is a UUID followed by another 22
characters; would have thought that just a UUID would be enough.
I would at least file a documentation bug to be more clear of what
movePath: (and copyPath:) actually do under the covers. I would have
assumed that both would create a file with the real filename (i.e.
movePath:@"foo"... would first create "foo" in the destination
folder). The docs only mention that a file is created with the exact
contents of the original, and then the original is deleted. It
doesn't mention anything about the created file having an auto-
generated name followed by renaming that upon a successful move/copy.
Having said that, I would suppose that a workaround of doing a
copyPath:toPath:handler: following by a removeFileAtPath:handler
would also fail, especially if copyPath also has an implementation
such that an auto-generated name is done.
It also appears that NSFileManager's delegate methods offer no
workaround since they're only used to monitor activities (i.e. 'read-
only' operations so-to-speak)
Perhaps another solution is to step down to using NSFileHandle? You
should then be able to manage the file copy/move yourself.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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