[wpiutil] Remove RuntimeDetector and simplify RuntimeLoader (#6600)

This commit is contained in:
Jade
2024-05-25 01:48:59 +08:00
committed by GitHub
parent 72a6d22d9a
commit 6220c6be4d
22 changed files with 99 additions and 474 deletions

View File

@@ -11,16 +11,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
/** WPIMath JNI. */
public final class WPIMathJNI {
static boolean libraryLoaded = false;
static RuntimeLoader<WPIMathJNI> loader = null;
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader =
new RuntimeLoader<>(
"wpimathjni", RuntimeLoader.getDefaultExtractionRoot(), WPIMathJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
RuntimeLoader.loadLibrary("wpimathjni");
} catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
@@ -37,10 +33,7 @@ public final class WPIMathJNI {
if (libraryLoaded) {
return;
}
loader =
new RuntimeLoader<>(
"wpimathjni", RuntimeLoader.getDefaultExtractionRoot(), WPIMathJNI.class);
loader.loadLibrary();
RuntimeLoader.loadLibrary("wpimathjni");
libraryLoaded = true;
}