Revision: 27980
http://sourceforge.net/p/bibdesk/svn/27980
Author: hofman
Date: 2022-10-01 22:43:12 +0000 (Sat, 01 Oct 2022)
Log Message:
-----------
separate method to load default servers
Modified Paths:
--------------
trunk/bibdesk/BDSKSearchGroupServerManager.m
Modified: trunk/bibdesk/BDSKSearchGroupServerManager.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroupServerManager.m 2022-10-01 22:25:06 UTC
(rev 27979)
+++ trunk/bibdesk/BDSKSearchGroupServerManager.m 2022-10-01 22:43:12 UTC
(rev 27980)
@@ -65,6 +65,20 @@
return [[[NSWorkspace sharedWorkspace] typeOfFile:[[path
stringByStandardizingPath] stringByResolvingSymlinksInPath] error:NULL]
isEqualToUTI:@"net.sourceforge.bibdesk.bdsksearch"];
}
+- (void)loadDefaultServers {
+ NSString *path = [[NSBundle mainBundle] pathForResource:SERVERS_FILENAME
ofType:@"plist"];
+ NSArray *serverDicts = [NSArray arrayWithContentsOfFile:path];
+ for (NSDictionary *dict in serverDicts) {
+ BDSKServerInfo *info = [[BDSKServerInfo alloc]
initWithDictionary:dict];
+ if (info) {
+ [defaultSearchGroupServerNames addObject:[info name]];
+ [searchGroupServers addObject:info];
+ [info release];
+ }
+ }
+ [searchGroupServers sortUsingDescriptors:sortDescriptors];
+}
+
- (void)loadCustomServers {
NSURL *applicationSupportURL = [[NSFileManager defaultManager]
applicationSupportDirectoryURL];
NSString *serversPath = [[applicationSupportURL
URLByAppendingPathComponent:SERVERS_DIRNAME isDirectory:YES] path];
@@ -114,7 +128,7 @@
searchGroupServerFiles = [[NSMutableDictionary alloc] init];
defaultSearchGroupServerNames = [[NSMutableSet alloc] init];
sortDescriptors = [[NSArray alloc] initWithObjects:typeSort, nameSort,
nil];
- [self resetServers];
+ [self loadDefaultServers];
[self loadCustomServers];
}
return self;
@@ -122,24 +136,10 @@
- (void)resetServers {
[searchGroupServers removeAllObjects];
+ [self loadDefaultServers];
- NSString *path = [[NSBundle mainBundle] pathForResource:SERVERS_FILENAME
ofType:@"plist"];
-
- NSArray *serverDicts = [NSArray arrayWithContentsOfFile:path];
- for (NSDictionary *dict in serverDicts) {
- BDSKServerInfo *info = [[BDSKServerInfo alloc]
initWithDictionary:dict];
- if (info) {
- [defaultSearchGroupServerNames addObject:[info name]];
- [searchGroupServers addObject:info];
- [info release];
- }
- }
-
- [searchGroupServers sortUsingDescriptors:sortDescriptors];
-
- // there are no files registered on init
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
- for (path in [searchGroupServerFiles allValues])
+ for (NSString *path in [searchGroupServerFiles allValues])
[ws performFileOperation:NSWorkspaceRecycleOperation source:[path
stringByDeletingLastPathComponent] destination:@"" files:[NSArray
arrayWithObjects:[path lastPathComponent], nil] tag:NULL];
[searchGroupServerFiles removeAllObjects];
}
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