Skip to content

Commit 443fd89

Browse files
committed
when users shoot themselves in the foot, point them to the hospital (fixes #581)
1 parent e29f0fd commit 443fd89

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

app/src/processing/app/Base.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,6 +2344,8 @@ static public void locateSketchbookFolder() {
23442344
}
23452345
}
23462346
}
2347+
2348+
// make sure the libraries/modes/tools directories exist
23472349
makeSketchbookSubfolders();
23482350
}
23492351

app/src/processing/app/SketchName.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SketchName {
3131
*/
3232
static File nextFolder(File parentDir) {
3333
String approach = Preferences.get("sketch.name.approach");
34-
if (!CLASSIC.equals(approach)) {
34+
if ((approach != null) && !CLASSIC.equals(approach)) {
3535
WordList wl = getWordLists().get(approach);
3636
//File folder = wordsFolder(parentDir, approach);
3737
File folder = wl.wordsFolder(parentDir);

app/src/processing/app/contrib/ContributionManager.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,31 @@ static private void updateFlagged(Base base, File root) throws Exception {
571571
if (!root.exists()) return; // folder doesn't exist, nothing to update
572572

573573
if (!root.canRead() || !root.canWrite()) {
574-
throw new Exception("Please fix read/write permissions for " + root);
574+
// Sometimes macOS users disallow access to the Documents folder,
575+
// then wonder why there's a problem accessing the Documents folder.
576+
// https://github.com/processing/processing4/issues/581
577+
// TODO would like this to be in a more central location, but this is
578+
// where it's triggered most consistently, so it's here for now.
579+
if (Platform.isMacOS()) {
580+
// we're on the EDT here, so it's safe to show the error
581+
Messages.showError("Cannot access sketchbook",
582+
"""
583+
There is a problem with the “permissions” for the sketchbook folder.
584+
Processing needs access to the Documents folder to save your work.
585+
Usually this happens after you click “Don't Allow” when macOS asks
586+
for access to your Documents folder. To fix:
587+
588+
1. Quit Processing
589+
2. Open Applications → Utilities → Terminal
590+
3. Type “tccutil reset All org.processing.four” and press return
591+
4. Restart Processing, and when prompted for access, click “OK”
592+
593+
If that's not the problem, the forum is a good place to get help:
594+
https://discourse.processing.org
595+
""", null);
596+
} else {
597+
throw new Exception("Please fix read/write permissions for " + root);
598+
}
575599
}
576600

577601
File[] markedForUpdate = root.listFiles(folder ->

todo.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ X https://github.com/processing/processing4/issues/549
4646
X put in a note about the cleaning process
4747
X too many temp folders prevent restart
4848
X https://github.com/processing/processing4/issues/582
49+
X if user clicks "no" when asked to access Documents folder, will cause weird problems later
50+
X "Please fix read/write" in ContributionManager.updateFlagged()
51+
X but that also shouldn't prevent users from continuing
52+
X https://github.com/processing/processing4/issues/581
53+
X use tccutil or some api to check whether user has disallowed access
54+
X https://recoursive.com/2020/03/03/reset_macos_privacy_permissions/
4955

5056

5157
_ "Show Sketch Folder" for libraries needs to treat the sketch as Untitled
@@ -58,12 +64,6 @@ _ https://github.com/processing/processing4/issues/565
5864
_ expanded language codes to support traditional Chinese translation
5965
_ https://github.com/processing/processing4/issues/600
6066

61-
_ if user clicks "no" when asked to access Documents folder, will cause weird problems later
62-
_ "Please fix read/write" in ContributionManager.updateFlagged()
63-
_ but that also shouldn't prevent users from continuing
64-
_ https://github.com/processing/processing4/issues/581
65-
_ use tccutil or some api to check whether user has disallowed access
66-
6767
_ preproc inserting weird number of spaces
6868
_ before 'public' in functions, it's an extra single space
6969
_ not indenting the rest of the code at all

0 commit comments

Comments
 (0)