Skip to content

Commit

Permalink
eliminated dependence on Carbon.framework, fixed some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm committed Dec 9, 2011
1 parent 76997c7 commit b29d8bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Classes/NDAlias+AliasFile.m
Expand Up @@ -28,8 +28,9 @@ of this software and associated documentation files (the "Software"), to deal
#import "NSURL+NDCarbonUtilities.h" #import "NSURL+NDCarbonUtilities.h"
#import "NDResourceFork+OtherSorces.h" #import "NDResourceFork+OtherSorces.h"


const OSType finderCreatorCode = 0x4D414353; // 'MACS' static const ResType aliasResourceType = 0x616C6973; // 'alis'
const short aliasRecordId = 0; static const OSType finderCreatorCode = 0x4D414353; // 'MACS'
static const short aliasRecordId = 0;


@implementation NDAlias (AliasFile) @implementation NDAlias (AliasFile)


Expand Down Expand Up @@ -84,7 +85,7 @@ - (id)initWithContentsOfFile:(NSString *)aPath
NDResourceFork * theResourceFork; NDResourceFork * theResourceFork;
theResourceFork = [[NDResourceFork alloc] initForReadingAtPath:aPath]; theResourceFork = [[NDResourceFork alloc] initForReadingAtPath:aPath];


self = [self initWithData:[theResourceFork dataForType:formAlias Id:aliasRecordId]]; self = [self initWithData:[theResourceFork dataForType:aliasResourceType Id:aliasRecordId]];


[theResourceFork closeFile]; [theResourceFork closeFile];
[theResourceFork release]; [theResourceFork release];
Expand All @@ -97,7 +98,7 @@ - (id)initWithContentsOfURL:(NSURL *)aURL
NDResourceFork * theResourceFork; NDResourceFork * theResourceFork;
theResourceFork = [[NDResourceFork alloc] initForReadingAtURL:aURL]; theResourceFork = [[NDResourceFork alloc] initForReadingAtURL:aURL];


self = [self initWithData:[theResourceFork dataForType:formAlias Id:aliasRecordId]]; self = [self initWithData:[theResourceFork dataForType:aliasResourceType Id:aliasRecordId]];


[theResourceFork closeFile]; [theResourceFork closeFile];
[theResourceFork release]; [theResourceFork release];
Expand Down Expand Up @@ -126,7 +127,7 @@ - (BOOL)writeToURL:(NSURL *)aURL includeCustomIcon:(BOOL)aCustomIcon
NDResourceFork * theResourceFork; NDResourceFork * theResourceFork;


theResourceFork = [[NDResourceFork alloc] initForWritingAtURL:aURL]; theResourceFork = [[NDResourceFork alloc] initForWritingAtURL:aURL];
theSuccess = [theResourceFork addData:[self data] type:formAlias Id:aliasRecordId name:@"created by NDAlias"]; theSuccess = [theResourceFork addData:[self data] type:aliasResourceType Id:aliasRecordId name:@"created by NDAlias"];


if( theSuccess ) if( theSuccess )
{ {
Expand Down Expand Up @@ -176,4 +177,3 @@ - (BOOL)writeToURL:(NSURL *)aURL includeCustomIcon:(BOOL)aCustomIcon
} }


@end @end

22 changes: 11 additions & 11 deletions Classes/NDResourceFork.h
Expand Up @@ -32,7 +32,7 @@
*/ */


#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <Carbon/Carbon.h> #import <CoreServices/CoreServices.h>
#import "NDSDKCompatibility.h" #import "NDSDKCompatibility.h"


/*! /*!
Expand All @@ -49,31 +49,31 @@
/*! /*!
@method resourceForkForReadingAtURL: @method resourceForkForReadingAtURL:
@abstract Creates and initalises a <tt>NDResourceFork</tt>. @abstract Creates and initalises a <tt>NDResourceFork</tt>.
@discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for reading using the file url.. The <tt>NDResourceFork</tt> resource fork is closed when the receiver is deallocated. @discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for reading using the file url. You must invoke closeFile when you are finished with the object.
@param URL A file url specifying the name and location of the file whose resource fork is to be opened. @param URL A file url specifying the name and location of the file whose resource fork is to be opened.
@result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed. @result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed.
*/ */
+ (id)resourceForkForReadingAtURL:(NSURL *)URL; + (id)resourceForkForReadingAtURL:(NSURL *)URL;
/*! /*!
@method resourceForkForWritingAtURL: @method resourceForkForWritingAtURL:
@abstract Creates and initalises a <tt>NDResourceFork</tt>. @abstract Creates and initalises a <tt>NDResourceFork</tt>.
@discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. The <tt>NDResourceFork</tt> resource fork is closed when the receiver is deallocated. @discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. You must invoke closeFile when you are finished with the object.
@param URL A file url specifying the name and location of the file whose resource fork is to be opened. @param URL A file url specifying the name and location of the file whose resource fork is to be opened.
@result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed. @result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed.
*/ */
+ (id)resourceForkForWritingAtURL:(NSURL *)URL; + (id)resourceForkForWritingAtURL:(NSURL *)URL;
/*! /*!
@method resourceForkForReadingAtPath: @method resourceForkForReadingAtPath:
@abstract Creates and initalises a <tt>NDResourceFork</tt>. @abstract Creates and initalises a <tt>NDResourceFork</tt>.
@discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for reading using the path. The receiver's resource fork is closed when the receiver is deallocated. @discussion Creates and intializes a <tt>NDResourceFork</tt> and opens a resource fork for reading using the path. You must invoke closeFile when you are finished with the object.
@param path A path specifying the name and location of the file whose resource fork is to be opened. @param path A path specifying the name and location of the file whose resource fork is to be opened.
@result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed. @result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed.
*/ */
+ (id)resourceForkForReadingAtPath:(NSString *)path; + (id)resourceForkForReadingAtPath:(NSString *)path;
/*! /*!
@method resourceForkForWritingAtPath: @method resourceForkForWritingAtPath:
@abstract Creates and initalises a <tt>NDResourceFork</tt>. @abstract Creates and initalises a <tt>NDResourceFork</tt>.
@discussion Creates and intializes a <tt>NDResourceFork</tt>r and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. The receiver's resource fork is closed when the receiver is deallocated. @discussion Creates and intializes a <tt>NDResourceFork</tt>r and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. You must invoke closeFile when you are finished with the object.
@param path A path specifying the name and location of the file whose resource fork is to be opened. @param path A path specifying the name and location of the file whose resource fork is to be opened.
@result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed. @result A <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or Create and initalise failed.
*/ */
Expand All @@ -83,30 +83,30 @@
@method initForReadingAtURL: @method initForReadingAtURL:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for reading using the file url. @discussion Intializes the receiver and opens a resource fork for reading using the file url.
@param URL A file url specifying the name and location of the file whose resource fork is to be opened. The receiver's resource fork is closed when the receiver is deallocated. @param URL A file url specifying the name and location of the file whose resource fork is to be opened. You must invoke closeFile when you are finished with the object.
@result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed. @result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed.
*/ */
- (id)initForReadingAtURL:(NSURL *)URL; - (id)initForReadingAtURL:(NSURL *)URL;
/*! /*!
@method initForReadingAtURL: @method initForReadingAtURL:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. The receiver's resource fork is closed when the receiver is deallocated. @discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. You must invoke closeFile when you are finished with the object.
@param URL A file url specifying the name and location of the file whose resource fork is to be opened. @param URL A file url specifying the name and location of the file whose resource fork is to be opened.
@result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed. @result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed.
*/ */
- (id)initForWritingAtURL:(NSURL *)URL; - (id)initForWritingAtURL:(NSURL *)URL;
/*! /*!
@method initForReadingAtPath: @method initForReadingAtPath:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for reading using the path. The receiver's resource fork is closed when the receiver is deallocated. @discussion Intializes the receiver and opens a resource fork for reading using the path. You must invoke closeFile when you are finished with the object.
@param path A path specifying the name and location of the file whose resource fork is to be opened. @param path A path specifying the name and location of the file whose resource fork is to be opened.
@result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed. @result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed.
*/ */
- (id)initForReadingAtPath:(NSString *)path; - (id)initForReadingAtPath:(NSString *)path;
/*! /*!
@method initForWritingAtPath: @method initForWritingAtPath:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. The receiver's resource fork is closed when the receiver is deallocated. @discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. You must invoke closeFile when you are finished with the object.
@param path A path specifying the name and location of the file whose resource fork is to be opened. @param path A path specifying the name and location of the file whose resource fork is to be opened.
@result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed. @result An initialized <tt>NDResourceFork</tt> for an opened resource fork, returns <tt>nil</tt> if the resource fork could not be opened or initalization failed.
*/ */
Expand All @@ -122,7 +122,7 @@
/*! /*!
@method initForPermission:atURL: @method initForPermission:atURL:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for reading and/or writting using the file url. If write permission is specified, then an empty resource fork created before hand if it does not already exists. The receiver's resource fork is closed when the receiver is deallocated.Possible permission values are as follows; @discussion Intializes the receiver and opens a resource fork for reading and/or writting using the file url. If write permission is specified, then an empty resource fork created before hand if it does not already exists. You must invoke closeFile when you are finished with the object.Possible permission values are as follows;
<blockquote> <blockquote>
<table border=0 cellpadding=4> <table border=0 cellpadding=4>
<tr><td width=80 valign=top><tt>fsCurPerm</tt></td> <tr><td width=80 valign=top><tt>fsCurPerm</tt></td>
Expand All @@ -149,7 +149,7 @@
/*! /*!
@method initForPermission:atPath: @method initForPermission:atPath:
@abstract Initalises a <tt>NDResourceFork</tt>. @abstract Initalises a <tt>NDResourceFork</tt>.
@discussion Intializes the receiver and opens a resource fork for reading and/or writting using the path. If write permission is specified, then an empty resource fork created before hand if it does not already exists. The receiver's resource fork is closed when the receiver is deallocated. Possible permission values are as follows; @discussion Intializes the receiver and opens a resource fork for reading and/or writting using the path. If write permission is specified, then an empty resource fork created before hand if it does not already exists. You must invoke closeFile when you are finished with the object. Possible permission values are as follows;
<blockquote> <blockquote>
<table border=0 cellpadding=4> <table border=0 cellpadding=4>
<tr><td width=80 valign=top><tt>fsCurPerm</tt></td> <tr><td width=80 valign=top><tt>fsCurPerm</tt></td>
Expand Down

0 comments on commit b29d8bc

Please sign in to comment.