Skip to content

Commit

Permalink
fix: also checks if the folder is readable
Browse files Browse the repository at this point in the history
Merely detecting writability is not enough, as the folder permissions may be "Write only (Drop Box)".
  • Loading branch information
ACTCD committed Sep 29, 2024
1 parent 2700906 commit 0ec57bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xcode/App-Mac/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ func getSaveLocationURL() -> URL {
}

func setSaveLocationURL(url: URL) -> Bool {
guard FileManager.default.isReadableFile(atPath: url.path) else {
let alert = NSAlert()
alert.messageText = "Can not read to path. Choose a different path."
alert.runModal()
return false
}
guard FileManager.default.isWritableFile(atPath: url.path) else {
let alert = NSAlert()
alert.messageText = "Can not write to path. Choose a different path."
Expand Down

0 comments on commit 0ec57bd

Please sign in to comment.