Skip to content

Commit

Permalink
when users shoot themselves in the foot, point them to the hospital (f…
Browse files Browse the repository at this point in the history
…ixes #581)
  • Loading branch information
benfry committed Nov 24, 2022
1 parent e29f0fd commit 443fd89
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -2344,6 +2344,8 @@ static public void locateSketchbookFolder() {
}
}
}

// make sure the libraries/modes/tools directories exist
makeSketchbookSubfolders();
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/processing/app/SketchName.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 25 additions & 1 deletion app/src/processing/app/contrib/ContributionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,31 @@ static private void updateFlagged(Base base, File root) throws Exception {
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 ->
Expand Down
12 changes: 6 additions & 6 deletions todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 443fd89

Please sign in to comment.