Revision: 11540
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11540&view=rev
Author:   hofman
Date:     2007-11-11 09:29:34 -0800 (Sun, 11 Nov 2007)

Log Message:
-----------
Reorganization of file API.

Modified Paths:
--------------
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h  2007-11-11 17:29:10 UTC 
(rev 11539)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h  2007-11-11 17:29:34 UTC 
(rev 11540)
@@ -69,23 +69,21 @@
 - (id)initWithPath:(NSString *)aPath delegate:(id)aDelegate;
 - (id)initWithURL:(NSURL *)aURL delegate:(id)aDelegate;
 
-- (void)setFileRef:(const FSRef *)newFileRef;
+- (void)setDelegate:(id)aDelegate;
+- (id)delegate;
+
+- (NSString *)relativePath;
+- (void)setRelativePath:(NSString *)newRelativePath;
+
 - (const FSRef *)fileRef;
 - (NSURL *)fileURL;
 - (NSString *)path;
 
 - (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath;
 - (NSString *)base64StringRelativeToPath:(NSString *)newBasePath;
-- (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath;
 
-- (NSString *)relativePath;
-- (void)setRelativePath:(NSString *)newRelativePath;
-
 - (void)update;
 
-- (void)setDelegate:(id)aDelegate;
-- (id)delegate;
-
 @end
 
 

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m  2007-11-11 17:29:10 UTC 
(rev 11539)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m  2007-11-11 17:29:34 UTC 
(rev 11540)
@@ -499,37 +499,23 @@
 
 // Should we implement -isEqual: and -hash?
 
-// this could be called when the document fileURL changes
-- (void)update {
-    NSURL *baseURL = [delegate baseURLForAliasFile:self];
-    FSRef baseRef;
-    
-    if (fileRef == NULL) {
-        // this does the updating if possible
-        [self fileRef];
-    } else {
-        CFURLRef aURL = CFURLCreateFromFSRef(CFAllocatorGetDefault(), fileRef);
-        if (aURL == NULL) {
-            // the fileRef was invalid, reset it and update
-            [self setFileRef:NULL];
-            [self fileRef];
-        } else {
-            CFRelease(aURL);
-            if (baseURL && CFURLGetFSRef((CFURLRef)baseURL, &baseRef)) {
-                Boolean didUpdate;
-                if (alias)
-                    FSUpdateAlias(&baseRef, fileRef, [alias alias], 
&didUpdate);
-                else
-                    alias = [[BDAlias alloc] initWithFSRef:(FSRef *)fileRef 
relativeToFSRef:&baseRef];
-                if (baseURL) {
-                    CFURLRef tmpURL = 
CFURLCreateFromFSRef(CFAllocatorGetDefault(), fileRef);
-                    if (tmpURL) {
-                        [self setRelativePath:[[baseURL path] 
relativePathToFilename:[(NSURL *)tmpURL path]]];
-                        CFRelease(tmpURL);
-                    }
-                }
-            }
-        }
+- (id)delegate {
+    return delegate;
+}
+
+- (void)setDelegate:(id)newDelegate {
+    NSParameterAssert(nil == newDelegate || [newDelegate 
respondsToSelector:@selector(baseURLForAliasFile:)]);
+    delegate = newDelegate;
+}
+
+- (NSString *)relativePath {
+    return relativePath;
+}
+
+- (void)setRelativePath:(NSString *)newRelativePath {
+    if (relativePath != newRelativePath) {
+        [relativePath release];
+        relativePath = [newRelativePath retain];
     }
 }
 
@@ -651,24 +637,38 @@
     return [[NSKeyedArchiver archivedDataWithRootObject:dictionary] 
base64String];
 }
 
-- (NSString *)relativePath {
-    return relativePath;
-}
-
-- (void)setRelativePath:(NSString *)newRelativePath {
-    if (relativePath != newRelativePath) {
-        [relativePath release];
-        relativePath = [newRelativePath retain];
+// this could be called when the document fileURL changes
+- (void)update {
+    NSURL *baseURL = [delegate baseURLForAliasFile:self];
+    FSRef baseRef;
+    
+    if (fileRef == NULL) {
+        // this does the updating if possible
+        [self fileRef];
+    } else {
+        CFURLRef aURL = CFURLCreateFromFSRef(CFAllocatorGetDefault(), fileRef);
+        if (aURL == NULL) {
+            // the fileRef was invalid, reset it and update
+            [self setFileRef:NULL];
+            [self fileRef];
+        } else {
+            CFRelease(aURL);
+            if (baseURL && CFURLGetFSRef((CFURLRef)baseURL, &baseRef)) {
+                Boolean didUpdate;
+                if (alias)
+                    FSUpdateAlias(&baseRef, fileRef, [alias alias], 
&didUpdate);
+                else
+                    alias = [[BDAlias alloc] initWithFSRef:(FSRef *)fileRef 
relativeToFSRef:&baseRef];
+                if (baseURL) {
+                    CFURLRef tmpURL = 
CFURLCreateFromFSRef(CFAllocatorGetDefault(), fileRef);
+                    if (tmpURL) {
+                        [self setRelativePath:[[baseURL path] 
relativePathToFilename:[(NSURL *)tmpURL path]]];
+                        CFRelease(tmpURL);
+                    }
+                }
+            }
+        }
     }
 }
 
-- (id)delegate {
-    return delegate;
-}
-
-- (void)setDelegate:(id)newDelegate {
-    NSParameterAssert(nil == newDelegate || [newDelegate 
respondsToSelector:@selector(baseURLForAliasFile:)]);
-    delegate = newDelegate;
-}
-
 @end


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to