Re: Alias vs. Symbolic Link
Re: Alias vs. Symbolic Link
- Subject: Re: Alias vs. Symbolic Link
- From: email@hidden
- Date: Sat, 5 May 2001 17:11:20 -0700
On Saturday, May 5, 2001, at 05:02 PM, Steve Gehrman wrote:
is there a simple way or testing if a file is an alias? I don't need to
resolve it, just need to know if it's an alias or a regular file.
Try the following:
BOOL isAliasFile(const NSString* inPath)
{
BOOL result = NO;
// Get an FSRef from the path
FSRef fsRef;
OSStatus err = FSPathMakeRef([inPath fileSystemRepresentation],
&fsRef, NULL);
if (err == noErr)
{
// Get the FinderInfo for the file
FSCatalogInfo catalogInfo;
err = FSGetCatalogInfo(& fsRef, kFSCatInfoFinderInfo,
&catalogInfo, NULL, NULL, NULL);
if (err == noErr)
{
// Check the isAlias bit
FileInfo* info = (FileInfo*)&catalogInfo.finderInfo;
result = (info->finderFlags & kIsAlias) != 0;
}
}
return result;
}