Skip to content
This repository

Resource manager #1156

Merged
merged 3 commits into from over 1 year ago

2 participants

Rob McBroom Patrick Robertson
Rob McBroom
Owner

As part of #1128, we created a new way to specify resources according to OS version. It turns out there was already a way to handle this. You just give an array of resources and all of them will be tried until one is found. That's a bit slower as it has to go to disk while it iterates through the potential resources, but it's much easier on developers since they don't have to keep up a bunch of OS-specific keys.

I've reverted the changes and defined the printer icon as an array instead.

Patrick Robertson
Owner

So we're back to the method I suggested? Wahey! :P

Were there any other resources that had the new format? I seems to remember a removable disks one, or did you change that for everyone?

Rob McBroom
Owner

Were there any other resources that had the new format? I seems to remember a removable disks one, or did you change that for everyone?

No, we found one that everyone has.

Patrick Robertson
Owner

Cool, merged

Patrick Robertson pjrobertson merged commit fb775c1 into from
Patrick Robertson pjrobertson closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
24  Quicksilver/Code-QuickStepCore/QSResourceManager.m
@@ -56,26 +56,8 @@ - (NSImage *)sysIconNamed:(NSString *)name {
56 56
 - (NSString *)resourceNamed:(NSString *)name inBundle:(NSBundle *)bundle {
57 57
 	return nil;
58 58
 }
59  
-
60  
-- (id)locatorForImageNamed:(NSString *)name
61  
-{
62  
-	// check for an icon specific to this version of OS X (10.x.x)
63  
-	NSString *nameWithOS = [NSString stringWithFormat:@"%@[%@]", name, [NSApplication macOSXFullVersion]];
64  
-	id locator = [resourceDict objectForKey:nameWithOS];
65  
-	if (!locator) {
66  
-		// check for an icon specific to this release of OS X (10.x)
67  
-		nameWithOS = [NSString stringWithFormat:@"%@[%@]", name, [NSApplication macOSXReleaseVersion]];
68  
-		locator = [resourceDict objectForKey:nameWithOS];
69  
-	}
70  
-	if (!locator) {
71  
-		// check for an icon using only the name
72  
-		locator = [resourceDict objectForKey:name];
73  
-	}
74  
-	return locator;
75  
-}
76  
-
77 59
 - (NSString *)pathForImageNamed:(NSString *)name {
78  
-	id locator = [self locatorForImageNamed:name];
  60
+	id locator = [resourceDict objectForKey:name];
79 61
 	return [self pathWithLocatorInformation:locator];
80 62
 }
81 63
 
@@ -89,7 +71,7 @@ - (NSImage *)imageWithExactName:(NSString *)name {
89 71
 
90 72
 	}
91 73
 
92  
-	id locator = [self locatorForImageNamed:name];
  74
+	id locator = [resourceDict objectForKey:name];
93 75
 	if ([locator isKindOfClass:[NSNull class]]) return nil;
94 76
 	if (locator)
95 77
 		image = [self imageWithLocatorInformation:locator];
@@ -112,7 +94,7 @@ - (NSImage *)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle {
112 94
 
113 95
 	if (image) { return image; }
114 96
 
115  
-	id locator = [self locatorForImageNamed:name];
  97
+	id locator = [resourceDict objectForKey:name];
116 98
 	if ([locator isKindOfClass:[NSNull class]]) { return nil; }
117 99
 	if (locator) {
118 100
 		image = [self imageWithLocatorInformation:locator];
7  Quicksilver/Resources/ResourceLocations.plist
@@ -69,10 +69,11 @@
69 69
 	<string>KEXT</string>
70 70
 	<key>PrefFileIcon</key>
71 71
 	<string>/Applications/System Preferences.app/Contents/Resources/PrefFile.icns</string>
72  
-	<key>PrintCenterIcon[10.8]</key>
73  
-	<string>/System/Library/CoreServices/AddPrinter.app/Contents/Resources/Printer.icns</string>
74 72
 	<key>PrintCenterIcon</key>
75  
-	<string>/System/Library/CoreServices/AddPrinter.app/Contents/Resources/GenericPostscriptPrinter.icns</string>
  73
+	<array>
  74
+		<string>/System/Library/CoreServices/AddPrinter.app/Contents/Resources/Printer.icns</string>
  75
+		<string>/System/Library/CoreServices/AddPrinter.app/Contents/Resources/GenericPostscriptPrinter.icns</string>
  76
+	</array>
76 77
 	<key>RecentItemsIcon</key>
77 78
 	<string>Recent</string>
78 79
 	<key>SafariHistoryIcon</key>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.