Revision: 29881
http://sourceforge.net/p/bibdesk/svn/29881
Author: hofman
Date: 2025-11-22 17:56:42 +0000 (Sat, 22 Nov 2025)
Log Message:
-----------
Use current methods to load array or dictionary from file
Modified Paths:
--------------
trunk/bibdesk/BDSKBookmarkController.m
trunk/bibdesk/BDSKCharacterConversion.m
trunk/bibdesk/BDSKConverter.m
trunk/bibdesk/BDSKDocumentController.m
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/BDSKPreferenceController.m
trunk/bibdesk/BDSKSearchBookmarkController.m
trunk/bibdesk/BDSKSearchGroup.m
trunk/bibdesk/BDSKSearchGroupServerManager.m
trunk/bibdesk/BDSKTypeManager.m
trunk/bibdesk/BibDocument+Scripting.m
trunk/bibdesk/NSFileManager_BDSKExtensions.m
Modified: trunk/bibdesk/BDSKBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKBookmarkController.m 2025-11-22 17:36:02 UTC (rev
29880)
+++ trunk/bibdesk/BDSKBookmarkController.m 2025-11-22 17:56:42 UTC (rev
29881)
@@ -111,7 +111,7 @@
[[NSFileManager defaultManager]
copyFileFromSharedSupportToApplicationSupport:@"Bookmarks.plist" overwrite:NO];
NSURL *bookmarksURL = [[[NSFileManager defaultManager]
applicationSupportDirectoryURL] URLByAppendingPathComponent:@"Bookmarks.plist"
isDirectory:NO];
- NSArray *bookmarksData = [NSArray
arrayWithContentsOfURL:bookmarksURL];
+ NSArray *bookmarksData = [NSArray
arrayWithContentsOfURL:bookmarksURL error:NULL];
bookmarkRoot = [[BDSKBookmark alloc]
initRootWithChildrenDictionaries:bookmarksData];
[self startObservingBookmarks:@[bookmarkRoot]];
Modified: trunk/bibdesk/BDSKCharacterConversion.m
===================================================================
--- trunk/bibdesk/BDSKCharacterConversion.m 2025-11-22 17:36:02 UTC (rev
29880)
+++ trunk/bibdesk/BDSKCharacterConversion.m 2025-11-22 17:56:42 UTC (rev
29881)
@@ -65,7 +65,7 @@
self = [super initWithWindow:nil];
if (self) {
- NSDictionary *tmpDict = [NSDictionary
dictionaryWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:CHARACTER_CONVERSION_FILENAME ofType:nil]];
+ NSDictionary *tmpDict = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:CHARACTER_CONVERSION_FILENAME withExtension:nil] error:NULL];
defaultRomanSet = [[NSSet alloc] initWithArray:[[tmpDict
objectForKey:ROMAN_TO_TEX_KEY] allKeys]];
defaultTexSet = [[NSSet alloc] initWithArray:[[tmpDict
objectForKey:TEX_TO_ROMAN_KEY] allKeys]];
@@ -103,7 +103,7 @@
[texSet removeAllObjects];
if ([charConvURL checkResourceIsReachableAndReturnError:NULL]) {
- NSDictionary *tmpDict = [NSDictionary
dictionaryWithContentsOfURL:charConvURL];
+ NSDictionary *tmpDict = [NSDictionary
dictionaryWithContentsOfURL:charConvURL error:NULL];
[oneWayDict addEntriesFromDictionary:[tmpDict
objectForKey:ONE_WAY_CONVERSION_KEY]];
[twoWayDict addEntriesFromDictionary:[tmpDict
objectForKey:ROMAN_TO_TEX_KEY]];
Modified: trunk/bibdesk/BDSKConverter.m
===================================================================
--- trunk/bibdesk/BDSKConverter.m 2025-11-22 17:36:02 UTC (rev 29880)
+++ trunk/bibdesk/BDSKConverter.m 2025-11-22 17:56:42 UTC (rev 29881)
@@ -72,7 +72,7 @@
- (void)loadDict{
- NSDictionary *wholeDict = [NSDictionary
dictionaryWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:CHARACTER_CONVERSION_FILENAME ofType:nil]];
+ NSDictionary *wholeDict = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:CHARACTER_CONVERSION_FILENAME withExtension:nil] error:NULL];
NSDictionary *userWholeDict = nil;
// look for the user file
NSFileManager *fm = [NSFileManager defaultManager];
@@ -79,7 +79,7 @@
NSURL *charConvURL = [[fm applicationSupportDirectoryURL]
URLByAppendingPathComponent:CHARACTER_CONVERSION_FILENAME isDirectory:NO];
if ([charConvURL checkResourceIsReachableAndReturnError:NULL]) {
- userWholeDict = [NSDictionary
dictionaryWithContentsOfURL:charConvURL];
+ userWholeDict = [NSDictionary
dictionaryWithContentsOfURL:charConvURL error:NULL];
}
// set up the dictionaries
Modified: trunk/bibdesk/BDSKDocumentController.m
===================================================================
--- trunk/bibdesk/BDSKDocumentController.m 2025-11-22 17:36:02 UTC (rev
29880)
+++ trunk/bibdesk/BDSKDocumentController.m 2025-11-22 17:56:42 UTC (rev
29881)
@@ -371,7 +371,7 @@
if ([theUTI isEqualToUTI:@"net.sourceforge.bibdesk.bdskcache"]) {
- NSDictionary *dictionary = [NSDictionary
dictionaryWithContentsOfURL:absoluteURL];
+ NSDictionary *dictionary = [NSDictionary
dictionaryWithContentsOfURL:absoluteURL error:NULL];
NSURL *fileURL = [NSURL fileURLWithAliasData:[dictionary
valueForKey:@"FileAlias"] bookmarkData:[dictionary
valueForKey:@"FileBookmark"]];
// if the alias didn't work, let's see if we have a filepath key...
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2025-11-22 17:36:02 UTC (rev 29880)
+++ trunk/bibdesk/BDSKEditor.m 2025-11-22 17:56:42 UTC (rev 29881)
@@ -1444,7 +1444,7 @@
downloadPlistURL = [[NSURL alloc]
initFileURLWithPath:downloadPlistFileName];
}
- NSDictionary *theDictionary = [NSDictionary
dictionaryWithContentsOfURL:downloadPlistURL];
+ NSDictionary *theDictionary = [NSDictionary
dictionaryWithContentsOfURL:downloadPlistURL error:NULL];
if(nil == theDictionary)
NSLog(@"failed to read Safari download property list %@ ",
downloadPlistURL);
Modified: trunk/bibdesk/BDSKPreferenceController.m
===================================================================
--- trunk/bibdesk/BDSKPreferenceController.m 2025-11-22 17:36:02 UTC (rev
29880)
+++ trunk/bibdesk/BDSKPreferenceController.m 2025-11-22 17:56:42 UTC (rev
29881)
@@ -541,8 +541,8 @@
}
- (void)loadPreferences {
- NSString *plistPath = [[NSBundle mainBundle]
pathForResource:DEFAULTS_TABLE ofType:@"plist"];
- NSArray *categoryArray = [NSArray arrayWithContentsOfFile:plistPath];
+ NSURL *plistURL = [[NSBundle mainBundle] URLForResource:DEFAULTS_TABLE
withExtension:@"plist"];
+ NSArray *categoryArray = [NSArray arrayWithContentsOfURL:plistURL
error:NULL];
NSMutableDictionary *initialValues = [NSMutableDictionary dictionary];
NSAssert(categoryArray != nil, @"Could not find preferences in main
bundle");
Modified: trunk/bibdesk/BDSKSearchBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKSearchBookmarkController.m 2025-11-22 17:36:02 UTC
(rev 29880)
+++ trunk/bibdesk/BDSKSearchBookmarkController.m 2025-11-22 17:56:42 UTC
(rev 29881)
@@ -608,7 +608,7 @@
if ([fileURLs count] > 0) {
if (idx == NSOutlineViewDropOnItemIndex && [item bookmarkType] ==
BDSKSearchBookmarkTypeBookmark) {
NSURL *fileURL = [fileURLs objectAtIndex:0];
- NSMutableDictionary *dict = [NSMutableDictionary
dictionaryWithContentsOfURL:fileURL];
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc]
initWithContentsOfURL:fileURL error:NULL];
if (dict) {
NSDictionary *oldInfo = [item info];
[dict setValue:[oldInfo valueForKey:@"search term"]
forKey:@"search term"];
@@ -620,7 +620,7 @@
idx = [[item children] count];
NSMutableArray *newBookmarks = [NSMutableArray array];
for (NSURL *fileURL in fileURLs) {
- NSDictionary *dict = [NSDictionary
dictionaryWithContentsOfURL:fileURL];
+ NSDictionary *dict = [[NSDictionary alloc]
initWithContentsOfURL:fileURL error:NULL];
if (dict) {
NSString *label = [[fileURL lastPathComponent]
stringByDeletingPathExtension];
BDSKSearchBookmark *bookmark = [[BDSKSearchBookmark
alloc] initWithInfo:dict label:label];
Modified: trunk/bibdesk/BDSKSearchGroup.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroup.m 2025-11-22 17:36:02 UTC (rev 29880)
+++ trunk/bibdesk/BDSKSearchGroup.m 2025-11-22 17:56:42 UTC (rev 29881)
@@ -134,7 +134,7 @@
if ([bdsksearchURL isFileURL]) {
- dictionary = [NSDictionary dictionaryWithContentsOfURL:bdsksearchURL];
+ dictionary = [NSDictionary dictionaryWithContentsOfURL:bdsksearchURL
error:NULL];
Class groupClass = NSClassFromString([dictionary
objectForKey:@"class"]);
if (groupClass && groupClass != [self class]) {
self = [[groupClass class] alloc];
Modified: trunk/bibdesk/BDSKSearchGroupServerManager.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroupServerManager.m 2025-11-22 17:36:02 UTC
(rev 29880)
+++ trunk/bibdesk/BDSKSearchGroupServerManager.m 2025-11-22 17:56:42 UTC
(rev 29881)
@@ -66,8 +66,8 @@
}
- (void)loadDefaultServers {
- NSString *path = [[NSBundle mainBundle] pathForResource:SERVERS_FILENAME
ofType:@"plist"];
- NSArray *serverDicts = [NSArray arrayWithContentsOfFile:path];
+ NSURL *fileURL = [[NSBundle mainBundle] URLForResource:SERVERS_FILENAME
withExtension:@"plist"];
+ NSArray *serverDicts = [NSArray arrayWithContentsOfURL:fileURL error:NULL];
for (NSDictionary *dict in serverDicts) {
BDSKServerInfo *info = [[BDSKServerInfo alloc]
initWithDictionary:dict];
if (info) {
@@ -230,8 +230,8 @@
- (void)resetServerAtIndex:(NSUInteger)idx {
NSString *name = [[searchGroupServers objectAtIndex:idx] name];
- NSString *path = [[NSBundle mainBundle] pathForResource:SERVERS_FILENAME
ofType:@"plist"];
- NSArray *serverDicts = [NSArray arrayWithContentsOfFile:path];
+ NSURL *fileURL = [[NSBundle mainBundle] URLForResource:SERVERS_FILENAME
withExtension:@"plist"];
+ NSArray *serverDicts = [NSArray arrayWithContentsOfURL:fileURL error:NULL];
for (NSDictionary *dict in serverDicts) {
if ([[dict objectForKey:@"name"] isEqualToString:name]) {
BDSKServerInfo *info = [[BDSKServerInfo alloc]
initWithDictionary:dict];
Modified: trunk/bibdesk/BDSKTypeManager.m
===================================================================
--- trunk/bibdesk/BDSKTypeManager.m 2025-11-22 17:36:02 UTC (rev 29880)
+++ trunk/bibdesk/BDSKTypeManager.m 2025-11-22 17:56:42 UTC (rev 29881)
@@ -122,8 +122,8 @@
self = [super init];
if (self) {
- NSDictionary *typeInfoDict = [NSDictionary
dictionaryWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:TYPE_INFO_FILENAME ofType:@"plist"]];
- NSDictionary *userTypeInfoDict = [NSDictionary
dictionaryWithContentsOfURL:BDSKUserTypeInfoURL()] ?: typeInfoDict;
+ NSDictionary *typeInfoDict = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:TYPE_INFO_FILENAME withExtension:@"plist"] error:NULL];
+ NSDictionary *userTypeInfoDict = [NSDictionary
dictionaryWithContentsOfURL:BDSKUserTypeInfoURL() error:NULL] ?: typeInfoDict;
fieldsForTypesDict = [[userTypeInfoDict
objectForKey:FIELDS_FOR_TYPES_KEY] copy];
standardFieldsForTypes = [[NSMutableDictionary alloc] init];
Modified: trunk/bibdesk/BibDocument+Scripting.m
===================================================================
--- trunk/bibdesk/BibDocument+Scripting.m 2025-11-22 17:36:02 UTC (rev
29880)
+++ trunk/bibdesk/BibDocument+Scripting.m 2025-11-22 17:56:42 UTC (rev
29881)
@@ -1084,7 +1084,7 @@
} else if ([server isKindOfClass:[NSDictionary class]]) {
serverInfo = [BDSKServerInfo newServerInfo:nil
withScriptingServerInfo:server];
} else if ([server isKindOfClass:[NSURL class]]) {
- serverInfo = [[BDSKServerInfo alloc]
initWithDictionary:[NSDictionary dictionaryWithContentsOfURL:server]];
+ serverInfo = [[BDSKServerInfo alloc]
initWithDictionary:[NSDictionary dictionaryWithContentsOfURL:server
error:NULL]];
} else if ([server isKindOfClass:[NSString class]]) {
if ([server hasPrefix:@"x-bdsk-search://"]) {
serverInfo = [[BDSKServerInfo alloc]
initWithDictionary:[BDSKSearchGroup dictionaryWithBdsksearchURL:[NSURL
URLWithString:server]]];
Modified: trunk/bibdesk/NSFileManager_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSFileManager_BDSKExtensions.m 2025-11-22 17:36:02 UTC
(rev 29880)
+++ trunk/bibdesk/NSFileManager_BDSKExtensions.m 2025-11-22 17:56:42 UTC
(rev 29881)
@@ -200,7 +200,7 @@
if ([self fileExistsAtPath:[targetURL path] isDirectory:&isDir] == NO)
{
isDir = [self createDirectoryAtURL:targetURL
withIntermediateDirectories:NO attributes:nil error:NULL];
} else if (isDir && overwrite == NO && revisionHashes == nil) {
- revisionHashes = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:SUPPORT_FILE_REVISIONS_FILENAME withExtension:@"plist"]];
+ revisionHashes = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:SUPPORT_FILE_REVISIONS_FILENAME withExtension:@"plist"]
error:NULL];
}
if (isDir) {
for (NSString *file in [self contentsOfDirectoryAtPath:[sourceURL
path] error:NULL]) {
@@ -212,7 +212,7 @@
if ([targetURL checkResourceIsReachableAndReturnError:NULL]) {
if (overwrite == NO) {
if (revisionHashes == nil)
- revisionHashes = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:SUPPORT_FILE_REVISIONS_FILENAME withExtension:@"plist"]];
+ revisionHashes = [NSDictionary
dictionaryWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:SUPPORT_FILE_REVISIONS_FILENAME withExtension:@"plist"]
error:NULL];
NSArray *fileRevisionHashes = [revisionHashes
objectForKey:fileName];
if ([fileRevisionHashes count] == 0 || [fileRevisionHashes
containsObject:[targetURL md5Hash]] == NO)
return;
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