Skip to content

Commit

Permalink
alternative fix for #666
Browse files Browse the repository at this point in the history
  • Loading branch information
benfry committed Feb 16, 2023
1 parent a933bb2 commit 5c317e7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions app/src/processing/app/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -282,14 +284,20 @@ static public File getProcessingTemp() throws IOException {
if (directory.mkdirs()) {
// Set the parent directory writable for multi-user machines.
// https://github.com/processing/processing4/issues/666
if (!directory.setReadable(true, false)) {
System.err.println("Could not set readable for all: " + directory);
}
if (!directory.setWritable(true, false)) {
System.err.println("Could not set writable for all: " + directory);
}
if (!directory.setExecutable(true, false)) {
System.err.println("Could not set writable for all: " + directory);
if (Platform.isLinux()) {
Path path = directory.toPath();
Files.setPosixFilePermissions(path, PosixFilePermissions.fromString("rwxrwxrwx"));

} else {
if (!directory.setReadable(true, false)) {
System.err.println("Could not set readable for all: " + directory);
}
if (!directory.setWritable(true, false)) {
System.err.println("Could not set writable for all: " + directory);
}
if (!directory.setExecutable(true, false)) {
System.err.println("Could not set writable for all: " + directory);
}
}
} else {
throw new IOException("Could not create temp directory. " +
Expand Down

0 comments on commit 5c317e7

Please sign in to comment.