6
6
#import < MobileCoreServices/MobileCoreServices.h>
7
7
#import < Foundation/NSURL.h>
8
8
9
+ #ifndef APP_PATH
10
+ #define APP_PATH @" /private/preboot/procursus/Applications
11
+ #endif
12
+
9
13
@interface _LSApplicationState : NSObject
10
14
-(BOOL)isValid;
11
15
@end
@@ -79,10 +83,11 @@ void help(char *name) {
79
83
" -a, --all Update all system and internal applications\n"
80
84
" (replicates the old uicache behavior)\n"
81
85
" -f, --force Force -a to reregister all Applications\n"
86
+ " and modify App Store apps\n"
82
87
" -p, --path <path> Update application bundle at the specified path\n"
83
88
" -u, --unregister <path> Unregister application bundle at the specified path\n"
84
89
" -r, --respring Restart SpringBoard and backboardd after\n"
85
- " updating applications. \n "
90
+ " updating applications\n"
86
91
" -l, --list List the bundle ids of installed apps\n"
87
92
" -i, --info <bundleid> Give information about given bundle id\n"
88
93
" -h, --help Give this help list.\n\n"
@@ -98,6 +103,15 @@ void registerPath(char *path, int unregister) {
98
103
LSApplicationProxy *app = [LSApplicationProxy applicationProxyForIdentifier: [NSString stringWithUTF8String: path]];
99
104
path = (char *)[[app bundleURL ] fileSystemRepresentation ];
100
105
}
106
+
107
+ if ([[NSString stringWithUTF8String: path] hasPrefix: @" /private/var/containers/Bundle/Application" ] || [[NSString stringWithUTF8String: path] hasPrefix: @" /var/containers/Bundle/Application" ]) {
108
+ printf (" uicache does not support App Store apps.\n " );
109
+ if (force)
110
+ printf (" Continuing anyway...\n " );
111
+ else
112
+ return ;
113
+ }
114
+
101
115
NSString *rawPath = [NSString stringWithUTF8String: path];
102
116
rawPath = [rawPath stringByResolvingSymlinksInPath ];
103
117
@@ -210,6 +224,7 @@ void registerAll() {
210
224
}
211
225
212
226
NSArray <NSString *> *files = [[NSFileManager defaultManager ] contentsOfDirectoryAtPath: @" /Applications" error: nil ];
227
+ NSArray <NSString *> *filesSecondary = [[NSFileManager defaultManager ] contentsOfDirectoryAtPath: APP_PATH error: nil ];
213
228
214
229
NSMutableSet <NSString *> *installed = [[NSMutableSet alloc ] init ];
215
230
@@ -228,11 +243,26 @@ void registerAll() {
228
243
}
229
244
}
230
245
246
+ for (NSString *file in filesSecondary) {
247
+ if ([file hasSuffix: @" .app" ] &&
248
+ [[NSFileManager defaultManager ]
249
+ fileExistsAtPath: [NSString
250
+ stringWithFormat: @" %@ /%@ /Info.plist" , APP_PATH, file]] &&
251
+ [[NSFileManager defaultManager ]
252
+ fileExistsAtPath: [NSString stringWithFormat: @" %@ /%@ /%@ " ,
253
+ APP_PATH, file, [[NSDictionary dictionaryWithContentsOfURL: [NSURL
254
+ fileURLWithPath: [NSString stringWithFormat: @" %@ /%@ /Info.plist" , APP_PATH, file]] error: nil ]
255
+ valueForKey: @" CFBundleExecutable" ]]])
256
+ {
257
+ [installed addObject: [NSString stringWithFormat: @" %@ /%@ " , APP_PATH, file]];
258
+ }
259
+ }
260
+
231
261
NSMutableSet <NSString *> *registered = [[NSMutableSet alloc ] init ];
232
262
233
263
LSApplicationWorkspace *workspace = [LSApplicationWorkspace defaultWorkspace ];
234
264
for (LSApplicationProxy *app in [workspace allApplications ]) {
235
- if ([[NSString stringWithUTF8String: [[app bundleURL ] fileSystemRepresentation ]] hasPrefix: @" /Applications" ]) {
265
+ if ([[NSString stringWithUTF8String: [[app bundleURL ] fileSystemRepresentation ]] hasPrefix: @" /Applications" ] || [[ NSString stringWithUTF8String: [[app bundleURL ] fileSystemRepresentation ]] hasPrefix: APP_PATH] ) {
236
266
[registered addObject: [NSString stringWithUTF8String: [[app bundleURL ] fileSystemRepresentation ]]];
237
267
}
238
268
}
0 commit comments