mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-10 01:29:45 +03:00
[FIX] Фикс проверки версии.
This commit is contained in:
parent
2a59e8fe0b
commit
e7970bdbb3
1 changed files with 10 additions and 6 deletions
|
@ -48,9 +48,13 @@ public void run() {
|
||||||
try {
|
try {
|
||||||
GHRelease rel = gravitLauncher.getLatestRelease();
|
GHRelease rel = gravitLauncher.getLatestRelease();
|
||||||
Version relV = parseVer(rel.getTagName());
|
Version relV = parseVer(rel.getTagName());
|
||||||
if (!relV.equals(parent)) parent = relV;
|
if (relV == null) {
|
||||||
if (VERSION.major >= relV.major || VERSION.minor >= relV.minor
|
LogHelper.debug("Updater: parsing version error.");
|
||||||
|| VERSION.patch >= relV.patch || VERSION.build >= relV.build) return;
|
return;
|
||||||
|
}
|
||||||
|
if (!parent.equals(relV)) parent = relV;
|
||||||
|
if (VERSION.major >= relV.major && VERSION.minor >= relV.minor
|
||||||
|
&& VERSION.patch >= relV.patch && VERSION.build >= relV.build) return;
|
||||||
if (relV.release.equals(Type.STABLE) || relV.release.equals(Type.LTS)) {
|
if (relV.release.equals(Type.STABLE) || relV.release.equals(Type.LTS)) {
|
||||||
LogHelper.warning("New %s release: %s", relV.getReleaseStatus(), relV.getVersionString());
|
LogHelper.warning("New %s release: %s", relV.getReleaseStatus(), relV.getVersionString());
|
||||||
LogHelper.warning("You can download it: " + rel.getHtmlUrl().toString());
|
LogHelper.warning("You can download it: " + rel.getHtmlUrl().toString());
|
||||||
|
@ -66,12 +70,12 @@ public void run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
|
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
|
||||||
private static final Pattern pointPatternStriper = Pattern.compile("\\.");
|
private static final Pattern pointPatternSpltitter = Pattern.compile("\\.");
|
||||||
|
|
||||||
private static Version parseVer(String relS) {
|
private static Version parseVer(String relS) {
|
||||||
Matcher verMatcher = startingVerPattern.matcher(relS);
|
Matcher verMatcher = startingVerPattern.matcher(relS);
|
||||||
if (!verMatcher.find()) return VERSION;
|
if (!verMatcher.find()) return VERSION;
|
||||||
String[] ver = pointPatternStriper.split(relS.substring(verMatcher.start(), verMatcher.end()));
|
String[] ver = pointPatternSpltitter.split(relS.substring(verMatcher.start(), verMatcher.end()));
|
||||||
if (ver.length < 3) return VERSION;
|
if (ver.length < 3) return VERSION;
|
||||||
return new Version(Integer.parseInt(ver[0]), Integer.parseInt(ver[1]),
|
return new Version(Integer.parseInt(ver[0]), Integer.parseInt(ver[1]),
|
||||||
Integer.parseInt(ver[2]), ver.length > 3 ? Integer.parseInt(ver[3]) : 0, findRelType(relS.substring(verMatcher.end()+1)));
|
Integer.parseInt(ver[2]), ver.length > 3 ? Integer.parseInt(ver[3]) : 0, findRelType(relS.substring(verMatcher.end()+1)));
|
||||||
|
|
Loading…
Reference in a new issue