Skip to content

Commit

Permalink
Merge pull request #734 from quoid/fix/also-checks-if-the-directory-i…
Browse files Browse the repository at this point in the history
…s-readable

fix: also checks if the user selected folder is readable
  • Loading branch information
ACTCD authored Sep 30, 2024
2 parents 55f0f1b + 5ad82b4 commit 9248fa4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xcode/App-Mac/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ func getSaveLocationURL() -> URL {
}

func setSaveLocationURL(url: URL) -> Bool {
guard FileManager.default.isReadableFile(atPath: url.path) else {
let alert = NSAlert()
alert.messageText = "Cannot read the specified path; please choose a different one."
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."
alert.messageText = "Cannot write to the specified path; please choose a different one."
alert.runModal()
return false
}
Expand Down

0 comments on commit 9248fa4

Please sign in to comment.