[68] | 1 | #import <Foundation/Foundation.h>
|
---|
| 2 | #import "UICookieMonster.h"
|
---|
| 3 |
|
---|
| 4 | #define kProductID @"net.sabi.ICeCoffEE"
|
---|
| 5 |
|
---|
| 6 | // if the first path exists, it and all subsequent paths will be removed
|
---|
| 7 |
|
---|
| 8 | NSString* gGlobalPaths[] = {
|
---|
| 9 | @"/Library/InputManagers/ICeCoffEE",
|
---|
| 10 | @"/Library/Application Enhancers/ICeCoffEE.ape",
|
---|
| 11 | nil
|
---|
| 12 | };
|
---|
| 13 |
|
---|
| 14 | NSString* gLocalPaths[] = {
|
---|
| 15 | @"~/Library/InputManagers/ICeCoffEE",
|
---|
| 16 | @"~/Library/Application Enhancers/ICeCoffEE.ape",
|
---|
| 17 | nil
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | int main (int argc, const char * argv[]) {
|
---|
| 21 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
---|
| 22 | UICookieMonster* monster = [UICookieMonster monsterWithProductID:kProductID];
|
---|
| 23 | NSArray* files = [monster filesToRemove];
|
---|
| 24 |
|
---|
| 25 | if (!files || ![files count])
|
---|
| 26 | {
|
---|
| 27 | if ([[NSFileManager defaultManager] fileExistsAtPath:[gGlobalPaths[0] stringByExpandingTildeInPath]])
|
---|
| 28 | {
|
---|
| 29 | UICookieMonster* mons = [UICookieMonster monsterWithProductID:kProductID global:YES];
|
---|
| 30 | int i;
|
---|
| 31 |
|
---|
| 32 | for (i=0;gGlobalPaths[i];i++)
|
---|
| 33 | {
|
---|
| 34 | [mons addFile:[gGlobalPaths[i] stringByExpandingTildeInPath]];
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | [mons flush];
|
---|
| 38 | }
|
---|
| 39 | else if ([[NSFileManager defaultManager] fileExistsAtPath:[gLocalPaths[0] stringByExpandingTildeInPath]])
|
---|
| 40 | {
|
---|
| 41 | UICookieMonster* mons = [UICookieMonster monsterWithProductID:kProductID global:NO];
|
---|
| 42 | int i;
|
---|
| 43 |
|
---|
| 44 | for (i=0;gLocalPaths[i];i++)
|
---|
| 45 | {
|
---|
| 46 | [mons addFile:[gLocalPaths[i] stringByExpandingTildeInPath]];
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | [mons flush];
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | [pool release];
|
---|
| 54 | return 0;
|
---|
| 55 | }
|
---|