ResKnife/Cocoa/Categories/NSString-FSSpec.m

29 lines
589 B
Mathematica
Raw Normal View History

2002-10-12 08:45:54 +00:00
#import "NSString-FSSpec.h"
@implementation NSString (ResKnifeFSSpecExtensions)
- (FSRef *)createFSRef
{
FSRef *fsRef = NULL;
OSStatus error = FSPathMakeRef( [self fileSystemRepresentation], fsRef, NULL );
2002-10-12 08:45:54 +00:00
if( error == noErr )
return fsRef;
return NULL;
}
- (FSSpec *)createFSSpec
{
FSRef *fsRef = NULL;
FSSpec *fsSpec = NULL;
OSStatus error = FSPathMakeRef( [self fileSystemRepresentation], fsRef, NULL );
2002-10-12 08:45:54 +00:00
if( error == noErr )
{
error = FSGetCatalogInfo( fsRef, kFSCatInfoNone, NULL, NULL, fsSpec, NULL );
2002-10-12 08:45:54 +00:00
if( error == noErr )
return fsSpec;
}
return NULL;
}
@end