From e7e551c090620975e14f523679e6ff21daa55cf0 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 4 Apr 2023 00:21:35 +0200 Subject: [PATCH] Ignore update platform in exporting --- .../openrocket/gui/util/PreferencesExporter.java | 2 ++ .../sf/openrocket/gui/util/SwingPreferences.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/util/PreferencesExporter.java b/swing/src/net/sf/openrocket/gui/util/PreferencesExporter.java index 7d1104dbf..1dc895587 100644 --- a/swing/src/net/sf/openrocket/gui/util/PreferencesExporter.java +++ b/swing/src/net/sf/openrocket/gui/util/PreferencesExporter.java @@ -55,6 +55,8 @@ public abstract class PreferencesExporter { nodesToIgnore.add(SwingPreferences.NODE_WINDOWS); nodesToIgnore.add(SwingPreferences.NODE_TABLES); } + + keysToIgnore.add(SwingPreferences.UPDATE_PLATFORM); // Don't export platform-specific settings } diff --git a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java index 63686ffca..7b69dd85f 100644 --- a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java +++ b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java @@ -42,6 +42,7 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { public static final String NODE_WINDOWS = "windows"; public static final String NODE_TABLES = "tables"; + public static final String UPDATE_PLATFORM = "UpdatePlatform"; private static final List SUPPORTED_LOCALES; static { @@ -271,13 +272,22 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { return compdir; } + /** + * Set the operating system that the software updater will use to redirect you to an installer download link. + * @param platform the operating system to use + */ public void setUpdatePlatform(UpdatePlatform platform) { if (platform == null) return; - putString("UpdatePlatform", platform.name()); + putString(UPDATE_PLATFORM, platform.name()); } + /** + * Get the operating system that will be selected when asking for a software update. + * E.g. "Windows" will cause the software updater to default to letting you download a Windows installer. + * @return the operating system that is used + */ public UpdatePlatform getUpdatePlatform() { - String p = getString("UpdatePlatform", SystemInfo.getPlatform().name()); + String p = getString(UPDATE_PLATFORM, SystemInfo.getPlatform().name()); if (p == null) return null; return UpdatePlatform.valueOf(p); }