Revision: 28622
http://sourceforge.net/p/bibdesk/svn/28622
Author: hofman
Date: 2024-01-16 18:05:59 +0000 (Tue, 16 Jan 2024)
Log Message:
-----------
create bookmark data using objc method, don't need to worry about autorelease
Modified Paths:
--------------
trunk/bibdesk/BDSKLinkedFile.m
Modified: trunk/bibdesk/BDSKLinkedFile.m
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.m 2024-01-16 17:47:31 UTC (rev 28621)
+++ trunk/bibdesk/BDSKLinkedFile.m 2024-01-16 18:05:59 UTC (rev 28622)
@@ -56,7 +56,6 @@
static NSURL *BDSKURLFromFSRef(const FSRef *inRef);
static BOOL BDSKPathToFSRef(NSString *inPath, FSRef *outRef);
-static NSData *BDSKBookmarkDataFromURL(NSURL *aURL);
static NSDictionary *BDSKDictionaryFromPlistData(NSData *data);
static NSDictionary *BDSKDictionaryFromArchivedData(NSData *data);
@@ -808,7 +807,7 @@
NSString *basePath = [aDelegate basePathForLinkedFile:self];
NSString *relPath = basePath ? [aPath relativePathFromPath:basePath] : nil;
- id anAlias = BDSKBookmarkDataFromURL(aURL);
+ id anAlias = [aURL bookmarkDataWithOptions:0
includingResourceValuesForKeys:nil relativeToURL:nil error:NULL];
self = [self initWithAlias:anAlias relativePath:relPath
delegate:aDelegate];
if (self && basePath)
[self updateFileURL];
@@ -886,7 +885,7 @@
}
if (shouldUpdate) {
- NSData *data = BDSKBookmarkDataFromURL(fileURL ?: [fileRefURL
filePathURL]);
+ NSData *data = [(fileURL ?: [fileRefURL filePathURL])
bookmarkDataWithOptions:0 includingResourceValuesForKeys:nil relativeToURL:nil
error:NULL];
if (data) {
alias = data;
}
@@ -918,7 +917,7 @@
}
}
if (needsUpdate) {
- NSData *data = BDSKBookmarkDataFromURL(fileURL ?: [fileRefURL
filePathURL]);
+ NSData *data = [(fileURL ?: [fileRefURL filePathURL])
bookmarkDataWithOptions:0 includingResourceValuesForKeys:nil relativeToURL:nil
error:NULL];
if (data) {
alias = data;
}
@@ -960,10 +959,10 @@
NSData *data = nil;
if (fileURL) {
- data = BDSKBookmarkDataFromURL(fileURL);
+ data = [fileURL bookmarkDataWithOptions:0
includingResourceValuesForKeys:nil relativeToURL:nil error:NULL];
} else if (relativePath && newBasePath) {
NSURL *aURL = [NSURL fileURLWithPath:[relativePath isAbsolutePath] ?
relativePath : [[newBasePath stringByAppendingPathComponent:relativePath]
stringByStandardizingPath]];
- data = BDSKBookmarkDataFromURL(aURL);
+ data = [aURL bookmarkDataWithOptions:0
includingResourceValuesForKeys:nil relativeToURL:nil error:NULL];
}
if (data == nil && [alias isKindOfClass:[NSData class]])
data = [alias copy];
@@ -1073,14 +1072,6 @@
#pragma clang diagnostic pop
-static NSData *BDSKBookmarkDataFromURL(NSURL *aURL) {
- if (aURL == nil)
- return nil;
- // bookmark data before 10.12 was very large, hopefully that will be
better when saving a minimal bookmark
- // for newer OS versions minimal bookmarks do not seem to be smaller,
sometimnes even larger
- return CFBridgingRelease(CFURLCreateBookmarkData(kCFAllocatorDefault,
(__bridge CFURLRef)aURL, 0, NULL, NULL, NULL));
-}
-
static NSDictionary *BDSKDictionaryFromPlistData(NSData *data) {
NSDictionary *dictionary = [NSPropertyListSerialization
propertyListWithData:data options:NSPropertyListImmutable format:NULL
error:NULL];
if ([dictionary isKindOfClass:[NSDictionary class]] == NO)
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