SymLink duplicating troubles
SymLink duplicating troubles
- Subject: SymLink duplicating troubles
- From: Lorenzo Puleo <email@hidden>
- Date: Sat, 11 May 2002 23:55:09 +0200
Hi,
I have some trouble duplicating symLinks.
I would like to obtain an exact copy of a symLink, that is same original
target, same size, same owner, same permissions, same creation, modification
and backup date and locked flag. But what is working properly for files, is
not working for symLinks. Why?
1) ==============
I copy the symLink "sourceSymLink" to the
not yet existing destination symLink "destSymLink" this way:
[manager createSymbolicLinkAtPath:destSymLink pathContent:[sourceSymLink
stringByResolvingSymlinksInPath]];
It creates a symLink pointing to the target file properly. It works, but the
original symLink "sourceSymLink" is 24 bytes
while "destSymLink" is 81 bytes. (!)
2) ==============
Also I can't copy the attributes from the source link to the dest link.
The following API gives errors.
[manager changeFileAttributes:freeAttribute atPath:destSymLink];
the result is NO
And the following routine which copies dates and NodeFlags from source to
destination gives error -5000 on symLinks.
Please note it works properly with simple files/folders.
- (BOOL)SetCatInfo:(NSString*)sourceItem toDest:(NSString*)destItem
{
int err;
UInt8 *path;
FSRef sourceRef, destRef;
Boolean isFSDirectory;
FSCatalogInfo theInfo;
path = (UInt8*)[sourceItem UTF8String];
err = FSPathMakeRef(path, &sourceRef, &isFSDirectory);
if(err) return NO;
err = FSGetCatalogInfo(&sourceRef, kFSCatInfoSettableInfo, &theInfo,
nil, nil, nil);
if(err) return NO;
path = (UInt8*)[destItem UTF8String];
err = FSPathMakeRef(path, &destRef, &isFSDirectory);
if(err) return NO;
//the following line gives error -5000 on symLinks
err = FSSetCatalogInfo(&destRef, kFSCatInfoCreateDate |
kFSCatInfoContentMod | kFSCatInfoBackupDate | kFSCatInfoNodeFlags,
&theInfo);//
if(err) return NO;
}
I run with MacOS X 10.1.2. Is this the origin of my troubles?
Any assistance is appreciate.
Thank you.
Just to take a symLink on your computer, please locate:
/Library/Printers/Canon/BJPrinter/Frameworks/BJColor.framework/BJColor
--
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.