Generate video thumbnails

This commit is contained in:
Christoph Hagen
2025-01-25 22:14:31 +01:00
parent 200fdc813d
commit 06b4c1ed76
10 changed files with 254 additions and 54 deletions

View File

@ -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.
*/