From 0ec57bdf034242147a0d5c0b7a3ff851c36be1e2 Mon Sep 17 00:00:00 2001 From: ACTCD <101378590+ACTCD@users.noreply.github.com> Date: Sun, 29 Sep 2024 23:34:14 +0800 Subject: [PATCH 1/2] fix: also checks if the folder is readable Merely detecting writability is not enough, as the folder permissions may be "Write only (Drop Box)". --- xcode/App-Mac/Functions.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xcode/App-Mac/Functions.swift b/xcode/App-Mac/Functions.swift index 48770bfa..84b70999 100644 --- a/xcode/App-Mac/Functions.swift +++ b/xcode/App-Mac/Functions.swift @@ -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." From 5ad82b4966dc259123e3fa75c64912a7da151b17 Mon Sep 17 00:00:00 2001 From: ACTCD <101378590+ACTCD@users.noreply.github.com> Date: Sun, 29 Sep 2024 23:57:21 +0800 Subject: [PATCH 2/2] fix: improve prompt clarity and fluency --- xcode/App-Mac/Functions.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xcode/App-Mac/Functions.swift b/xcode/App-Mac/Functions.swift index 84b70999..a6608954 100644 --- a/xcode/App-Mac/Functions.swift +++ b/xcode/App-Mac/Functions.swift @@ -10,13 +10,13 @@ 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.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 }