-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathFSCapability.m
More file actions
26 lines (23 loc) · 744 Bytes
/
Copy pathFSCapability.m
File metadata and controls
26 lines (23 loc) · 744 Bytes
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
#import "FSCapability.h"
#import "dlsymfn.h"
static BOOL (*MGGetBoolAnswer)(NSString *capability);
BOOL FSSystemHasCapability(NSString *capabilityName)
{
if (!MGGetBoolAnswer) {
void *libMobileGestalt = dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_LAZY);
if (libMobileGestalt) {
MGGetBoolAnswer = dlsymfn(libMobileGestalt, "MGGetBoolAnswer");
}
#ifndef __arm64__
if (!MGGetBoolAnswer) {
void *libGraphicServices = dlopen("/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices", RTLD_LAZY);
if (libGraphicServices) {
MGGetBoolAnswer = dlsymfn(libGraphicServices, "GSSystemHasCapability");
}
}
#endif
}
if (MGGetBoolAnswer != NULL)
return MGGetBoolAnswer(capabilityName);
return NO;
}