]> git.saurik.com Git - cydget.git/commitdiff
Filter Cydget list using kCFCoreFoundationVersion.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 13:26:53 +0000 (05:26 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 13:49:02 +0000 (05:49 -0800)
CydgetSettings.mm

index cdd3a5a3acbf1a39ad701457375402462df8e23f..a97d19c879515135a82a07bc92bfbf1ba38d496d 100644 (file)
@@ -95,7 +95,25 @@ static NSString *_plist;
         NSMutableArray *themesOnDisk([NSMutableArray arrayWithCapacity:4]);
         for (NSString *theme in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/System/Library/LockCydgets" error:NULL])
             if ([theme hasSuffix:@".cydget"])
         NSMutableArray *themesOnDisk([NSMutableArray arrayWithCapacity:4]);
         for (NSString *theme in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/System/Library/LockCydgets" error:NULL])
             if ([theme hasSuffix:@".cydget"])
-                [themesOnDisk addObject:[theme stringByDeletingPathExtension]];
+                if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/System/Library/LockCydgets/%@/Info.plist", theme]]) {
+                    if (NSArray *version = [info objectForKey:@"CYVersionFilter"]) {
+                        size_t count([version count]);
+                        if (count == 0 || count > 2)
+                            continue;
+
+                        double lower([[version objectAtIndex:0] doubleValue]);
+                        if (kCFCoreFoundationVersionNumber < lower)
+                            continue;
+
+                        if (count != 1) {
+                            double upper([[version objectAtIndex:1] doubleValue]);
+                            if (upper <= kCFCoreFoundationVersionNumber)
+                                continue;
+                        }
+                    }
+
+                    [themesOnDisk addObject:[theme stringByDeletingPathExtension]];
+                }
 
         NSMutableSet *themesSet([NSMutableSet set]);
 
 
         NSMutableSet *themesSet([NSMutableSet set]);