From ad12f828ec0ceab865a3bde897e2d21f060173d9 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 24 Jan 2014 05:26:53 -0800 Subject: [PATCH] Filter Cydget list using kCFCoreFoundationVersion. --- CydgetSettings.mm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CydgetSettings.mm b/CydgetSettings.mm index cdd3a5a..a97d19c 100644 --- a/CydgetSettings.mm +++ b/CydgetSettings.mm @@ -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"]) - [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]); -- 2.45.2