Revision: 27632
          http://sourceforge.net/p/bibdesk/svn/27632
Author:   hofman
Date:     2022-06-15 15:45:50 +0000 (Wed, 15 Jun 2022)
Log Message:
-----------
move implementations specific for bookmark based linked file to that class

Modified Paths:
--------------
    trunk/bibdesk/BDSKLinkedFile.m

Modified: trunk/bibdesk/BDSKLinkedFile.m
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.m      2022-06-15 09:37:40 UTC (rev 27631)
+++ trunk/bibdesk/BDSKLinkedFile.m      2022-06-15 15:45:50 UTC (rev 27632)
@@ -514,49 +514,12 @@
     return hasSkimNotes;
 }
 
-// this is overridden by BDSKAliasLinkedFile
-- (NSData *)copyAliasDataRelativeToPath:(NSString *)basePath {
-    BDSKAlias *anAlias = NULL;
-    NSData *data = nil;
-    
-    if (fileURL) {
-        anAlias = [BDSKAlias newWithPath:[fileURL path] basePath:basePath];
-    } else if (relativePath && basePath) {
-        NSString *path = [relativePath isAbsolutePath] ? relativePath : 
[[basePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath];
-        anAlias = [BDSKAlias newWithPath:path basePath:basePath];
-    }
-    if (anAlias != NULL) {
-        data = [anAlias copyData];
-        [anAlias release];
-    } else if ([alias isKindOfClass:[BDSKAlias class]]) {
-        data = [alias copyData];
-    }
-    
-    return data;
+- (void)updateHasSkimNotes {
+    hasSkimNotesNeedsUpdate = YES;
+    if (isInitial == NO)
+        [delegate performSelector:@selector(linkedFileURLChanged:) 
withObject:self afterDelay:0.0];
 }
 
-// this is overridden by BDSKAliasLinkedFile
-- (NSData *)copyDataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark {
-    NSData *data = nil;
-    
-    if (fileURL) {
-        data = BDSKCreateBookmarkDataFromURL(fileURL);
-    } else if (relativePath && newBasePath) {
-        NSURL *aURL = [NSURL fileURLWithPath:[relativePath isAbsolutePath] ? 
relativePath : [[newBasePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath]];
-        data = BDSKCreateBookmarkDataFromURL(aURL);
-    }
-    if (data == nil && [alias isKindOfClass:[NSData class]])
-        data = [alias copy];
-    
-    if (data) {
-        *isBookmark = YES;
-    } else if ([alias isKindOfClass:[BDSKAlias class]]) {
-        data = [alias copyData];
-        *isBookmark = NO;
-    }
-    return data;
-}
-
 - (NSString *)stringRelativeToPath:(NSString *)newBasePath {
     BOOL noAlias = saveRelativePathOnly && newBasePath != nil;
     if (newBasePath == nil)
@@ -581,7 +544,13 @@
         return [[NSPropertyListSerialization dataWithPropertyList:dictionary 
format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL] base64String];
 }
 
-// this is implemented by the subclasses
+// implemented by the subclasses
+- (NSData *)copyAliasDataRelativeToPath:(NSString *)newBasePath { return nil; }
+
+// implemented by the subclasses
+- (NSData *)copyDataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark { return nil; }
+
+// implemented by the subclasses
 - (void)updateFileURL {}
 
 // This is called when the file is added (new or initially),
@@ -589,12 +558,6 @@
 // implemented by the subclasses
 - (void)updateWithPath:(NSString *)aPath {}
 
-- (void)updateHasSkimNotes {
-    hasSkimNotesNeedsUpdate = YES;
-    if (isInitial == NO)
-        [delegate performSelector:@selector(linkedFileURLChanged:) 
withObject:self afterDelay:0.0];
-}
-
 @end
 
 #pragma mark -
@@ -1010,6 +973,47 @@
     isInitial = NO;
 }
 
+- (NSData *)copyAliasDataRelativeToPath:(NSString *)basePath {
+    BDSKAlias *anAlias = NULL;
+    NSData *data = nil;
+    
+    if (fileURL) {
+        anAlias = [BDSKAlias newWithPath:[fileURL path] basePath:basePath];
+    } else if (relativePath && basePath) {
+        NSString *path = [relativePath isAbsolutePath] ? relativePath : 
[[basePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath];
+        anAlias = [BDSKAlias newWithPath:path basePath:basePath];
+    }
+    if (anAlias != NULL) {
+        data = [anAlias copyData];
+        [anAlias release];
+    } else if ([alias isKindOfClass:[BDSKAlias class]]) {
+        data = [alias copyData];
+    }
+    
+    return data;
+}
+
+- (NSData *)copyDataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark {
+    NSData *data = nil;
+    
+    if (fileURL) {
+        data = BDSKCreateBookmarkDataFromURL(fileURL);
+    } else if (relativePath && newBasePath) {
+        NSURL *aURL = [NSURL fileURLWithPath:[relativePath isAbsolutePath] ? 
relativePath : [[newBasePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath]];
+        data = BDSKCreateBookmarkDataFromURL(aURL);
+    }
+    if (data == nil && [alias isKindOfClass:[NSData class]])
+        data = [alias copy];
+    
+    if (data) {
+        *isBookmark = YES;
+    } else if ([alias isKindOfClass:[BDSKAlias class]]) {
+        data = [alias copyData];
+        *isBookmark = NO;
+    }
+    return data;
+}
+
 @end
 
 #pragma mark -

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to