2002-10-12 08:45:54 +00:00
|
|
|
#import "NSString-FSSpec.h"
|
|
|
|
|
|
|
|
@implementation NSString (ResKnifeFSSpecExtensions)
|
|
|
|
|
|
|
|
- (FSRef *)createFSRef
|
|
|
|
{
|
|
|
|
FSRef *fsRef = NULL;
|
2002-12-31 19:06:40 +00:00
|
|
|
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;
|
2002-12-31 19:06:40 +00:00
|
|
|
OSStatus error = FSPathMakeRef( [self fileSystemRepresentation], fsRef, NULL );
|
2002-10-12 08:45:54 +00:00
|
|
|
if( error == noErr )
|
|
|
|
{
|
2002-12-31 19:06:40 +00:00
|
|
|
error = FSGetCatalogInfo( fsRef, kFSCatInfoNone, NULL, NULL, fsSpec, NULL );
|
2002-10-12 08:45:54 +00:00
|
|
|
if( error == noErr )
|
|
|
|
return fsSpec;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|