Merge pull request #1022 from Stefterv/store-installs

Store where Processing is installed
This commit is contained in:
Stef Tervelde
2025-04-25 11:05:05 +02:00
committed by GitHub
+14
View File
@@ -166,6 +166,20 @@ public class Base {
static private void createAndShowGUI(String[] args) {
// these times are fairly negligible relative to Base.<init>
// long t1 = System.currentTimeMillis();
var preferences = java.util.prefs.Preferences.userRoot().node("org/processing/app");
var installLocations = new ArrayList<>(List.of(preferences.get("installLocations", "").split(",")));
var installLocation = System.getProperty("user.dir") + "^" + Base.getVersionName();
// Check if the installLocation is already in the list
if (!installLocations.contains(installLocation)) {
// Add the installLocation to the list
installLocations.add(installLocation);
// Save the updated list back to preferences
preferences.put("installLocations", String.join(",", installLocations));
}
// TODO: Cleanup old locations if no longer installed
// TODO: Cleanup old locations if current version is installed in the same location
File versionFile = Platform.getContentFile("lib/version.txt");
if (versionFile != null && versionFile.exists()) {