Skip to content

Commit 2c9ee1c

Browse files
committed
Linux Platform addition
1 parent 49988e9 commit 2c9ee1c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

java/preprocessor/src/main/java/processing/app/Platform.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ static public File getSettingsFolder() {
1515
}
1616
settingsFolder = new File(appData + "\\Processing");
1717
} else {
18-
settingsFolder = new File(System.getProperty("user.home") + "/.processing");
18+
// Check to see if the user has set a different location for their config
19+
String configHomeEnv = System.getenv("XDG_CONFIG_HOME");
20+
if (configHomeEnv != null && !configHomeEnv.isBlank()) {
21+
settingsFolder = new File(configHomeEnv);
22+
if (!settingsFolder.exists()) {
23+
settingsFolder = null; // don't use non-existent folder
24+
}
25+
}
26+
String snapUserCommon = System.getenv("SNAP_USER_COMMON");
27+
if (snapUserCommon != null && !snapUserCommon.isBlank()) {
28+
settingsFolder = new File(snapUserCommon);
29+
}
30+
if (settingsFolder == null) {
31+
settingsFolder = new File(System.getProperty("user.home"), ".config");
32+
}
1933
}
2034
return settingsFolder;
2135
}

0 commit comments

Comments
 (0)