forked from kpwn/uikittools-ng
-
Notifications
You must be signed in to change notification settings - Fork 14
/
lsrebuild.m
70 lines (61 loc) · 1.85 KB
/
lsrebuild.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#import <Foundation/Foundation.h>
#import <MobileCoreServices/MobileCoreServices.h>
#include <err.h>
#if NLS
# include <libintl.h>
# define _(a) gettext(a)
# define PACKAGE "uikittools-ng"
#else
# define _(a) a
#endif
#ifndef LOCALEDIR
# define LOCALEDIR "/usr/share/locale"
#endif
@interface LSResourceProxy : NSObject
@property(assign) NSString* localizedName;
- (NSData*)iconDataForVariant:(NSInteger)format;
@end
@interface LSApplicationProxy : LSResourceProxy
+ (LSApplicationProxy*)applicationProxyForIdentifier:(id)identifier;
- (NSString*)applicationIdentifier;
- (NSURL*)containerURL;
- (NSURL*)resourcesDirectoryURL;
@end
@interface LSOpenOperation : NSOperation
@end
@interface LSApplicationWorkspace : NSObject
+ (LSApplicationWorkspace*)defaultWorkspace;
- (NSArray*)applicationsAvailableForHandlingURLScheme:(NSString*)scheme;
- (LSOpenOperation*)operationToOpenResource:(NSURL*)URL
usingApplication:(NSString*)identifier
uniqueDocumentIdentifier:(NSString*)document
userInfo:(NSDictionary*)userInfo
delegate:(id)delegate;
@end
@interface LSApplicationWorkspace (LSPrivate)
- (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)arg1
internal:(BOOL)arg2
user:(BOOL)arg3;
@end
int main(int argc, char** argv) {
#if NLS
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
@autoreleasepool {
LSApplicationWorkspace* workspace = [LSApplicationWorkspace defaultWorkspace];
if (![workspace
respondsToSelector:@selector
(_LSPrivateRebuildApplicationDatabasesForSystemApps:internal:user:)]) {
errx(1, _("missing necessary method"));
}
if (![workspace
_LSPrivateRebuildApplicationDatabasesForSystemApps:YES
internal:YES
user:YES]) {
errx(1, _("RebuildApplicationDatabases failed"));
}
return 0;
}
}