Trigger folder access prompts in permission checks; add lead welcome
This commit is contained in:
@@ -56,9 +56,26 @@ func checkOrion() -> [String: String] {
|
||||
}
|
||||
}
|
||||
|
||||
func checkFolder(_ name: String, _ path: String) -> [String: String] {
|
||||
let dir = (NSHomeDirectory() as NSString).appendingPathComponent(path)
|
||||
if !FileManager.default.fileExists(atPath: dir) {
|
||||
return permission(name, "unchecked", "\(dir) doesn't exist.", "FilesAndFolders")
|
||||
}
|
||||
do {
|
||||
let entries = try FileManager.default.contentsOfDirectory(atPath: dir)
|
||||
return permission(name, "granted", "Listed \(dir) (entries: \(entries.count)).", "FilesAndFolders")
|
||||
} catch {
|
||||
return permission(name, "missing", "Listing \(dir) failed (\(error.localizedDescription)). Switch \(name) on under byre in Files & Folders.", "FilesAndFolders")
|
||||
}
|
||||
}
|
||||
|
||||
func runCheck() {
|
||||
Task.detached {
|
||||
let rows = [await checkScreenRecording(), checkAccessibility(), checkOrion()]
|
||||
let rows = [
|
||||
await checkScreenRecording(), checkAccessibility(), checkOrion(),
|
||||
checkFolder("Desktop Folder", "Desktop"), checkFolder("Documents Folder", "Documents"),
|
||||
checkFolder("Downloads Folder", "Downloads"), checkFolder("iCloud Drive", "Library/Mobile Documents/com~apple~CloudDocs"),
|
||||
]
|
||||
let out = try! JSONSerialization.data(withJSONObject: rows, options: .withoutEscapingSlashes)
|
||||
FileHandle.standardOutput.write(out + Data("\n".utf8))
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user