[73301] users/ryandesign/PCLauncher/LoginWindowController.m

ryandesign at macports.org ryandesign at macports.org
Tue Nov 9 16:32:04 PST 2010


Revision: 73301
          http://trac.macports.org/changeset/73301
Author:   ryandesign at macports.org
Date:     2010-11-09 16:32:00 -0800 (Tue, 09 Nov 2010)
Log Message:
-----------
Check for server ini files both in the data directory and in the preferences directory

Modified Paths:
--------------
    users/ryandesign/PCLauncher/LoginWindowController.m

Modified: users/ryandesign/PCLauncher/LoginWindowController.m
===================================================================
--- users/ryandesign/PCLauncher/LoginWindowController.m	2010-11-09 22:29:44 UTC (rev 73300)
+++ users/ryandesign/PCLauncher/LoginWindowController.m	2010-11-10 00:32:00 UTC (rev 73301)
@@ -69,26 +69,31 @@
 
 - (void)populateServerMenu {
 	[servers release];
-	NSString *serversDirectory = [kDataDirectory stringByAppendingPathComponent:@"servers"];
-	NSArray *allFiles = [[NSFileManager defaultManager] directoryContentsAtPath:serversDirectory];
-	NSArray *serverFiles = [allFiles filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.ini'"]];
 	servers = [[NSMutableArray alloc] init];
 	[serverMenu removeAllItems];
 	Server *server;
 	NSMenuItem *menuItem;
 	NSString *defaultServer = [[NSUserDefaults standardUserDefaults] stringForKey:@"server"];
-	for (int i = 0; i < [serverFiles count]; i++) {
-		server = [[Server alloc] initWithIniFilename:[serversDirectory stringByAppendingPathComponent:[serverFiles objectAtIndex:i]]];
-		menuItem = [[NSMenuItem alloc] initWithTitle:[server displayName] action:@selector(serverMenuChanged:) keyEquivalent:@""];
-		[menuItem setTarget:self];
-		[[serverMenu menu] addItem:menuItem];
-		if ([[server internalName] isEqualToString:defaultServer]) {
-			[serverMenu selectItem:menuItem];
+	NSArray *serversDirectories = [[NSArray alloc] initWithObjects:[kDataDirectory stringByAppendingPathComponent:@"servers"],
+								   [@"~/Library/Preferences/Uru Live/servers" stringByExpandingTildeInPath], nil];
+	for (int i = 0; i < [serversDirectories count]; i++) {
+		NSString *serversDirectory = [serversDirectories objectAtIndex:i];
+		NSArray *allFiles = [[NSFileManager defaultManager] directoryContentsAtPath:serversDirectory];
+		NSArray *serverFiles = [allFiles filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.ini'"]];
+		for (int j = 0; j < [serverFiles count]; j++) {
+			server = [[Server alloc] initWithIniFilename:[serversDirectory stringByAppendingPathComponent:[serverFiles objectAtIndex:j]]];
+			menuItem = [[NSMenuItem alloc] initWithTitle:[server displayName] action:@selector(serverMenuChanged:) keyEquivalent:@""];
+			[menuItem setTarget:self];
+			[[serverMenu menu] addItem:menuItem];
+			if ([[server internalName] isEqualToString:defaultServer]) {
+				[serverMenu selectItem:menuItem];
+			}
+			[menuItem release];
+			[servers addObject:server];
+			[server release];
 		}
-		[menuItem release];
-		[servers addObject:server];
-		[server release];
 	}
+	[serversDirectories release];
 }
 
 - (void)loadCurrentServerInfo {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101109/a7ba71a6/attachment.html>


More information about the macports-changes mailing list