Skip to content

Commit 87ba576

Browse files
committed
only run the update checker on windows
1 parent 8432331 commit 87ba576

File tree

1 file changed

+21
-19
lines changed
  • src/main/java/lol/hyper/customlauncher

1 file changed

+21
-19
lines changed

src/main/java/lol/hyper/customlauncher/Main.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import lol.hyper.customlauncher.accounts.JSONManager;
2121
import lol.hyper.customlauncher.accounts.windows.MainWindow;
2222
import lol.hyper.customlauncher.invasiontracker.InvasionTracker;
23-
import lol.hyper.customlauncher.setup.FirstSetup;
2423
import lol.hyper.customlauncher.ttrupdater.TTRUpdater;
2524
import lol.hyper.customlauncher.updater.UpdateChecker;
25+
import org.apache.commons.lang3.SystemUtils;
2626
import org.apache.logging.log4j.LogManager;
2727
import org.apache.logging.log4j.Logger;
2828
import org.json.JSONArray;
@@ -85,28 +85,30 @@ public static void main(String[] args) throws IOException {
8585
Main.logger.info("Converting account storage to JSONArray format.");
8686
}
8787

88-
String latestVersion = UpdateChecker.getLatestVersion();
89-
if (!latestVersion.equals(VERSION)) {
90-
logger.info("A new version is available! Version: " + latestVersion);
91-
int dialogResult =
92-
JOptionPane.showConfirmDialog(
93-
null,
94-
"A new update is available. Would you like to download the new version?",
95-
"New Update",
96-
JOptionPane.YES_NO_OPTION);
97-
if (dialogResult == JOptionPane.YES_OPTION) {
98-
UpdateChecker.downloadLatestVersion();
99-
int dialogResult2 =
88+
if (SystemUtils.IS_OS_WINDOWS) {
89+
String latestVersion = UpdateChecker.getLatestVersion();
90+
if (!latestVersion.equals(VERSION)) {
91+
logger.info("A new version is available! Version: " + latestVersion);
92+
int dialogResult =
10093
JOptionPane.showConfirmDialog(
10194
null,
102-
"Version "
103-
+ latestVersion
104-
+ " was downloaded. Would you like to run this new version?",
95+
"A new update is available. Would you like to download the new version?",
10596
"New Update",
10697
JOptionPane.YES_NO_OPTION);
107-
if (dialogResult2 == JOptionPane.YES_OPTION) {
108-
UpdateChecker.launchNewVersion(latestVersion);
109-
System.exit(0);
98+
if (dialogResult == JOptionPane.YES_OPTION) {
99+
UpdateChecker.downloadLatestVersion();
100+
int dialogResult2 =
101+
JOptionPane.showConfirmDialog(
102+
null,
103+
"Version "
104+
+ latestVersion
105+
+ " was downloaded. Would you like to run this new version?",
106+
"New Update",
107+
JOptionPane.YES_NO_OPTION);
108+
if (dialogResult2 == JOptionPane.YES_OPTION) {
109+
UpdateChecker.launchNewVersion(latestVersion);
110+
System.exit(0);
111+
}
110112
}
111113
}
112114
}

0 commit comments

Comments
 (0)