Generate video thumbnails
This commit is contained in:
@ -349,6 +349,16 @@ struct SecurityBookmark {
|
||||
perform { operation($0.appending(path: relativePath.withLeadingSlashRemoved)) }
|
||||
}
|
||||
|
||||
func with<T>(relativePath: String, perform operation: (URL) async -> T?) async -> T? {
|
||||
let path = url.appending(path: relativePath.withLeadingSlashRemoved)
|
||||
guard url.startAccessingSecurityScopedResource() else {
|
||||
delegate?.securityBookmark(error: "Failed to start security scope")
|
||||
return nil
|
||||
}
|
||||
defer { url.stopAccessingSecurityScopedResource() }
|
||||
return await operation(path)
|
||||
}
|
||||
|
||||
/**
|
||||
Run an operation in the security scope of a url.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user