Skip to content

Commit 88459e7

Browse files
committed
Store where Processing is installed
1 parent 2222331 commit 88459e7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/src/processing/app/Base.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,20 @@ static public void main(final String[] args) {
166166
static private void createAndShowGUI(String[] args) {
167167
// these times are fairly negligible relative to Base.<init>
168168
// long t1 = System.currentTimeMillis();
169+
var preferences = java.util.prefs.Preferences.userRoot().node("org/processing/app");
170+
var installLocations = new ArrayList<>(List.of(preferences.get("installLocations", "").split(",")));
171+
var installLocation = System.getProperty("user.dir") + "^" + Base.getVersionName();
172+
173+
// Check if the installLocation is already in the list
174+
if (!installLocations.contains(installLocation)) {
175+
// Add the installLocation to the list
176+
installLocations.add(installLocation);
177+
178+
// Save the updated list back to preferences
179+
preferences.put("installLocations", String.join(",", installLocations));
180+
}
181+
// TODO: Cleanup old locations if no longer installed
182+
// TODO: Cleanup old locations if current version is installed in the same location
169183

170184
File versionFile = Platform.getContentFile("lib/version.txt");
171185
if (versionFile != null && versionFile.exists()) {

0 commit comments

Comments
 (0)