From 2f61ac8fb65b5a999c92785c99b6e8570d3bbd19 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Thu, 19 Aug 2021 20:14:39 +0200 Subject: [PATCH] better version checking --- G-Earth/src/main/java/gearth/Main.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/G-Earth/src/main/java/gearth/Main.java b/G-Earth/src/main/java/gearth/Main.java index eea5579..7eebfe9 100644 --- a/G-Earth/src/main/java/gearth/Main.java +++ b/G-Earth/src/main/java/gearth/Main.java @@ -17,6 +17,7 @@ import javafx.scene.layout.Region; import javafx.scene.web.WebView; import javafx.stage.Stage; import org.apache.commons.io.IOUtils; +import org.apache.maven.artifact.versioning.ComparableVersion; import org.json.JSONObject; import java.io.IOException; @@ -78,7 +79,7 @@ public class Main extends Application { new URL(gitApi).openStream(), StandardCharsets.UTF_8)); String gitv = (String)object.get("tag_name"); - if (!gitv.equals(version)) { + if (new ComparableVersion(version).compareTo(new ComparableVersion(gitv)) < 0) { Platform.runLater(() -> { String body = (String)object.get("body"); boolean isForcedUpdate = body.contains("(!)");