mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2025-02-19 07:31:01 +00:00
more compatible way of checking for sandbox, hopefully
This commit is contained in:
parent
7103f11578
commit
4f627541d2
@ -238,13 +238,18 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
|
||||
#pragma mark - Files
|
||||
|
||||
- (BOOL)isSandboxed {
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
return YES;
|
||||
#else
|
||||
static dispatch_once_t onceToken;
|
||||
static BOOL sandboxed;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
|
||||
sandboxed = ![bundlePath hasPrefix:@"/Applications/"];
|
||||
// not sandboxed if parent of documents directory is "mobile"
|
||||
NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject.stringByStandardizingPath;
|
||||
sandboxed = ![documentsPath.stringByDeletingLastPathComponent.lastPathComponent isEqualToString:@"mobile"];
|
||||
});
|
||||
return sandboxed;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)diskImageExtensions {
|
||||
|
Loading…
x
Reference in New Issue
Block a user