X-Git-Url: https://git.saurik.com/uikittools.git/blobdiff_plain/7e0ec87a1c6cc62738348fe93656b5a4d81633a3..db9133b87555cf295f22b9c6ada353b2413395d2:/uicache.mm diff --git a/uicache.mm b/uicache.mm index cf88535..ea6ac7e 100644 --- a/uicache.mm +++ b/uicache.mm @@ -34,9 +34,11 @@ @end -int main() { +int main(int argc, const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + bool respring(false); + NSString *home(NSHomeDirectory()); NSString *path([NSString stringWithFormat:@"%@/Library/Caches/com.apple.mobile.installation.plist", home]); @@ -62,7 +64,7 @@ int main() { NSString *plist = [path stringByAppendingPathComponent:@"Info.plist"]; if (NSMutableDictionary *info = [NSMutableDictionary dictionaryWithContentsOfFile:plist]) { - if (NSString *bundle = [info objectForKey:@"CFBundleIdentifier"]) { + if ([info objectForKey:@"CFBundleIdentifier"] != nil) { [bundles addObject:path]; [info setObject:path forKey:@"Path"]; [info setObject:@"System" forKey:@"ApplicationType"]; @@ -85,18 +87,33 @@ int main() { fprintf(stderr, "%s\n", error == nil ? strerror(errno) : [[error localizedDescription] UTF8String]); } else fprintf(stderr, "cannot open cache file. incorrect user?\n"); - unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-icons"] UTF8String]); - unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-icons.plist"] UTF8String]); - - unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-smallicons"] UTF8String]); - unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-smallicons.plist"] UTF8String]); - - system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/SpringBoardIconCache"] UTF8String]); - system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/SpringBoardIconCache-small"] UTF8String]); - - system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/com.apple.IconsCache"] UTF8String]); - - notify_post("com.apple.mobile.application_installed"); + if (respring || kCFCoreFoundationVersionNumber >= 550.32) { + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-icons", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-icons.plist", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-smallicons", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.springboard-imagecache-smallicons.plist", home] UTF8String]); + + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.notificationCenterLinen", home] UTF8String]); + + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.0", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.1", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.2", home] UTF8String]); + unlink([[NSString stringWithFormat:@"%@/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.3", home] UTF8String]); + + system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/SpringBoardIconCache", home] UTF8String]); + system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/SpringBoardIconCache-small", home] UTF8String]); + system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/com.apple.IconsCache", home] UTF8String]); + system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/com.apple.newsstand", home] UTF8String]); + system([[NSString stringWithFormat:@"rm -rf %@/Library/Caches/com.apple.springboard.sharedimagecache", home] UTF8String]); + } + + system("killall installd"); + + if (respring) + system("launchctl stop com.apple.SpringBoard"); + else + notify_post("com.apple.mobile.application_installed"); [pool release];