mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-03 23:11:57 +03:00
[FIX] Updater исправлен парсинг типа версии и номера сборки.
This commit is contained in:
parent
8475d92362
commit
e3ac2b15e6
4 changed files with 10 additions and 6 deletions
|
@ -65,8 +65,8 @@ public void run() {
|
|||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
|
||||
|
||||
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+\\.?\\d*");
|
||||
private static final Pattern pointPatternSpltitter = Pattern.compile("\\.");
|
||||
|
||||
private static Version parseVer(String relS) {
|
||||
|
@ -75,11 +75,11 @@ private static Version parseVer(String relS) {
|
|||
String[] ver = pointPatternSpltitter.split(relS.substring(verMatcher.start(), verMatcher.end()));
|
||||
if (ver.length < 3) return VERSION;
|
||||
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())));
|
||||
}
|
||||
|
||||
private static Type findRelType(String substring) {
|
||||
if (substring.length() < 3 || substring.isEmpty()) return Type.UNKNOWN;
|
||||
if (substring.isEmpty()) return Type.UNKNOWN;
|
||||
String tS = substring;
|
||||
if (tS.startsWith("-")) tS = tS.substring(1);
|
||||
final String wrk = tS.toLowerCase(Locale.ENGLISH);
|
||||
|
|
|
@ -28,4 +28,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
wrapper {
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
defaultTasks 'build'
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -97,7 +97,7 @@ public enum Type {
|
|||
public static final Map<String, Type> unModTypes = Collections.unmodifiableMap(types);
|
||||
|
||||
static {
|
||||
Arrays.asList(values()).stream().forEach(type -> types.put(type.name().substring(0, type.name().length() < 3 ? type.name().length() : 3), type));
|
||||
Arrays.asList(values()).stream().forEach(type -> types.put(type.name().substring(0, type.name().length() < 3 ? type.name().length() : 3).toLowerCase(Locale.ENGLISH), type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue