when users shoot themselves in the foot, point them to the hospital (fixes #581)

This commit is contained in:
Ben Fry
2022-11-24 17:49:40 -05:00
parent e29f0fd5ff
commit 443fd8928b
4 changed files with 34 additions and 8 deletions
+2
View File
@@ -2344,6 +2344,8 @@ public class Base {
}
}
}
// make sure the libraries/modes/tools directories exist
makeSketchbookSubfolders();
}
+1 -1
View File
@@ -31,7 +31,7 @@ public class SketchName {
*/
static File nextFolder(File parentDir) {
String approach = Preferences.get("sketch.name.approach");
if (!CLASSIC.equals(approach)) {
if ((approach != null) && !CLASSIC.equals(approach)) {
WordList wl = getWordLists().get(approach);
//File folder = wordsFolder(parentDir, approach);
File folder = wl.wordsFolder(parentDir);
@@ -571,7 +571,31 @@ public class ContributionManager {
if (!root.exists()) return; // folder doesn't exist, nothing to update
if (!root.canRead() || !root.canWrite()) {
throw new Exception("Please fix read/write permissions for " + root);
// Sometimes macOS users disallow access to the Documents folder,
// then wonder why there's a problem accessing the Documents folder.
// https://github.com/processing/processing4/issues/581
// TODO would like this to be in a more central location, but this is
// where it's triggered most consistently, so it's here for now.
if (Platform.isMacOS()) {
// we're on the EDT here, so it's safe to show the error
Messages.showError("Cannot access sketchbook",
"""
There is a problem with the “permissions” for the sketchbook folder.
Processing needs access to the Documents folder to save your work.
Usually this happens after you click “Don't Allow” when macOS asks
for access to your Documents folder. To fix:
1. Quit Processing
2. Open Applications → Utilities → Terminal
3. Type “tccutil reset All org.processing.four” and press return
4. Restart Processing, and when prompted for access, click “OK”
If that's not the problem, the forum is a good place to get help:
https://discourse.processing.org
""", null);
} else {
throw new Exception("Please fix read/write permissions for " + root);
}
}
File[] markedForUpdate = root.listFiles(folder ->
+6 -6
View File
@@ -46,6 +46,12 @@ X https://github.com/processing/processing4/issues/549
X put in a note about the cleaning process
X too many temp folders prevent restart
X https://github.com/processing/processing4/issues/582
X if user clicks "no" when asked to access Documents folder, will cause weird problems later
X "Please fix read/write" in ContributionManager.updateFlagged()
X but that also shouldn't prevent users from continuing
X https://github.com/processing/processing4/issues/581
X use tccutil or some api to check whether user has disallowed access
X https://recoursive.com/2020/03/03/reset_macos_privacy_permissions/
_ "Show Sketch Folder" for libraries needs to treat the sketch as Untitled
@@ -58,12 +64,6 @@ _ https://github.com/processing/processing4/issues/565
_ expanded language codes to support traditional Chinese translation
_ https://github.com/processing/processing4/issues/600
_ if user clicks "no" when asked to access Documents folder, will cause weird problems later
_ "Please fix read/write" in ContributionManager.updateFlagged()
_ but that also shouldn't prevent users from continuing
_ https://github.com/processing/processing4/issues/581
_ use tccutil or some api to check whether user has disallowed access
_ preproc inserting weird number of spaces
_ before 'public' in functions, it's an extra single space
_ not indenting the rest of the code at all