промежуточный. проверка версии сапфора при асинхроноой сборке, из репозитория. Завтра доделаю и закоммичу

This commit is contained in:
2024-05-16 01:26:03 +03:00
parent 8a4371fc86
commit 630d6b3985
5 changed files with 88 additions and 43 deletions

View File

@@ -19,6 +19,7 @@ import java.io.File;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Vector;
public abstract class Sapfor extends OSDComponent {
public static final int empty_code = -100;
@@ -555,4 +556,29 @@ public abstract class Sapfor extends OSDComponent {
}
return false;
}
public static int readVersionFromCode(File versionFile) {
int res = Constants.Nan;
if (versionFile.exists()) {
try {
List<String> data = FileUtils.readLines(versionFile);
for (String s : data) {
if (s.startsWith("#define VERSION_SPF ")) {
String[] version_data = s.split("\"");
if (version_data.length > 0) {
String version_s = version_data[1];
//-
try {
res = Integer.parseInt(version_s);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
return res;
}
}