Re: Resolving alias
Re: Resolving alias
- Subject: Re: Resolving alias
- From: Nathan Day <email@hidden>
- Date: Thu, 16 Jan 2003 15:49:35 +1030
I have this as a category of NSString
/*
* +stringWithFSRef:
*/
+ (NSString *)stringWithFSRef:(const FSRef *)aFSRef
{
UInt8 thePath[PATH_MAX + 1]; // plus 1 for \0 terminator
return (FSRefMakePath ( aFSRef, thePath, PATH_MAX ) == noErr) ?
[NSString stringWithUTF8String:thePath] : nil;
}
/*
* -getFSRef:
*/
- (BOOL)getFSRef:(FSRef *)aFSRef
{
return FSPathMakeRef( [self UTF8String], aFSRef, NULL ) == noErr;
}
/*
* -resolveAliasFile
*/
- (NSString *)resolveAliasFile
{
FSRef theRef;
Boolean theIsTargetFolder,
theWasAliased;
NSString * theResolvedAlias = nil;;
[self getFSRef:&theRef];
if( (FSResolveAliasFile ( &theRef, YES, &theIsTargetFolder,
&theWasAliased ) == noErr) )
{
theResolvedAlias = (theWasAliased) ? [NSString
stringWithFSRef:&theRef] : self;
}
return theResolvedAlias;
}
On Wednesday, January 15, 2003, at 05:16 PM, Aidas Dailide wrote:
Hi!
I wonder, how could i resolve alias(not symbolink link). Looks like
NSFileManager doesn't has this command.
Thanks,
Aidas
_______________________________________________
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.
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
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.