Fix some sandbox issues.
This commit is contained in:
2 files changed
+7
-16
No files matched your search
+4
-9
@@ -707,8 +707,8 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
- (NSURL *)tempURL {
|
- (NSURL *)tempURL {
|
||||||
NSURL *tempURL = nil;
|
NSURL *tempURL = nil;
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
NSURL *folderURL = [fileURL URLByDeletingLastPathComponent];
|
NSURL *folderURL = [self.URL URLByDeletingLastPathComponent];
|
||||||
tempURL = [fileManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:folderURL create:YES error:&error];
|
tempURL = [NSFileManager.defaultManager URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask appropriateForURL:folderURL create:YES error:nil];
|
||||||
#else
|
#else
|
||||||
tempURL = [self.URL URLByDeletingLastPathComponent];
|
tempURL = [self.URL URLByDeletingLastPathComponent];
|
||||||
#endif
|
#endif
|
||||||
@@ -1255,22 +1255,17 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
[coder encodeInt:MP42FILE_VERSION forKey:@"MP42FileVersion"];
|
[coder encodeInt:MP42FILE_VERSION forKey:@"MP42FileVersion"];
|
||||||
|
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
if ([fileURL respondsToSelector:@selector(startAccessingSecurityScopedResource)]) {
|
|
||||||
NSData *bookmarkData = nil;
|
NSData *bookmarkData = nil;
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
bookmarkData = [fileURL bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
|
bookmarkData = [self.URL bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
|
||||||
includingResourceValuesForKeys:nil
|
includingResourceValuesForKeys:nil
|
||||||
relativeToURL:nil // Make it app-scoped
|
relativeToURL:nil // Make it app-scoped
|
||||||
error:&error];
|
error:&error];
|
||||||
if (error) {
|
if (error) {
|
||||||
NSLog(@"Error creating bookmark for URL (%@): %@", fileURL, error);
|
NSLog(@"Error creating bookmark for URL (%@): %@", self.URL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
[coder encodeObject:bookmarkData forKey:@"bookmark"];
|
[coder encodeObject:bookmarkData forKey:@"bookmark"];
|
||||||
|
|
||||||
} else {
|
|
||||||
[coder encodeObject:fileURL forKey:@"fileUrl"];
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if ([self.URL isFileReferenceURL]) {
|
if ([self.URL isFileReferenceURL]) {
|
||||||
[coder encodeObject:[self.URL filePathURL] forKey:@"fileUrl"];
|
[coder encodeObject:[self.URL filePathURL] forKey:@"fileUrl"];
|
||||||
|
|||||||
+3
-7
@@ -344,22 +344,18 @@
|
|||||||
[coder encodeInt64:_sourceId forKey:@"sourceId"];
|
[coder encodeInt64:_sourceId forKey:@"sourceId"];
|
||||||
|
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
if ([sourceURL respondsToSelector:@selector(startAccessingSecurityScopedResource)]) {
|
|
||||||
NSData *bookmarkData = nil;
|
NSData *bookmarkData = nil;
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
bookmarkData = [sourceURL bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
|
bookmarkData = [self.URL bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
|
||||||
includingResourceValuesForKeys:nil
|
includingResourceValuesForKeys:nil
|
||||||
relativeToURL:nil // Make it app-scoped
|
relativeToURL:nil // Make it app-scoped
|
||||||
error:&error];
|
error:&error];
|
||||||
if (error) {
|
if (error) {
|
||||||
NSLog(@"Error creating bookmark for URL (%@): %@", sourceURL, error);
|
NSLog(@"Error creating bookmark for URL (%@): %@", self.URL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
[coder encodeObject:bookmarkData forKey:@"bookmark"];
|
[coder encodeObject:bookmarkData forKey:@"bookmark"];
|
||||||
}
|
|
||||||
else {
|
|
||||||
[coder encodeObject:sourceURL forKey:@"sourceURL"];
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
[coder encodeObject:_URL forKey:@"sourceURL"];
|
[coder encodeObject:_URL forKey:@"sourceURL"];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user