Skip to content

Instantly share code, notes, and snippets.

@mikeash
Created September 5, 2011 14:59
Show Gist options
  • Save mikeash/1195176 to your computer and use it in GitHub Desktop.
Save mikeash/1195176 to your computer and use it in GitHub Desktop.
A basic sketch of an NSFileReference class interface
@interface NSFileReference : NSObject {
// internal storage would probably be NSURL, but could be
// NSString holding a path, FSRef, alias data, whatever
}
- (id)initWithPath: (NSString *)path;
- (id)initWithFileSystemRepresentation: (const char *)path;
- (id)initWithFSRef: (FSRef *)ref;
- (id)initWithAliasData: (NSData *)data;
- (id)initWithURL: (NSURL *)url;
- (NSString *)path;
- (const char *)fileSystemRepresentation;
- (BOOL)getFSRef: (FSRef *)outRef;
- (NSData *)aliasData;
- (NSURL *)url;
// in a perfect world, these two would return two different classes too
- (NSString *)name;
- (NSString *)displayName;
- (NSArray *)displayComponents;
- (NSFileReference *)parent;
- (NSFileReference *)childNamed: (NSString *)name;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment