On Apr 26, 2009, at 4:05 PM, Michael Hall wrote:


On Apr 26, 2009, at 8:22 AM, Iceberg-Dev wrote:

Is it possible to copy a symbolic link (the symbolic link file and not the item it references) using the FSPathCopyObjectSync API?

No valuable info was found in the documentation, the list archive, google results.

The File Manager Reference
http://developer.apple.com/documentation/Carbon/Reference/ File_Manager/Reference/reference.html#//apple_ref/c/func/ FSCopyObjectSync
saying
A pointer to the source object to copy. The object can be a file or a directory.


would suggest to me that a symlink file would be OK.

From what I'm seeing it's not.

My test case being like this:

I copy a symlink (pointing to a file that does not exist anymore) to a destination. When I use FSPathCopyObjectSync, it returns with error -43 (file not found).

Not sure if your searching came across "FSCopyObject - /Sources/ FSCopyObject.c"
http://developer.apple.com/SampleCode/FSCopyObject/listing3.html

but it might be informative to your question.

This is the solution I've been using till now. And it's a great solution if you need to get a solution that runs on Mac OS X 10.2 and later. But since I need 64-bit compatibility, I'm looking for solutions that I don't have to support if possible.

I was into these or similar links for a problem of my own yesterday but "the documentation, the list archive and google results" did lead to a resolution which they often do. I wasn't aware symlinks might be a problem until I started getting -1407 File Manager errors that seemed related to these files. Since you are aware in advance they might be a concern a little testing might give you a more definite answer and save some searching. (Fwiw, I eliminated the use in one place of an FSSpec since these seem to be getting more and more deprecated these days and I used FSPathMakeRefWithOptions (10.4+) in another place which looked like it would default resolve symlinks and these changes seemed to correct my own problem. No -1407 errors).

My solution so far is to go with FSCopyObjectSync and make the FSRef conversion. I was hoping I would escape the conversion by using the path version.


_______________________________________________

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

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

Reply via email to