[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,7 +11,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
/** WPIUtil JNI. */
public class WPIUtilJNI {
static boolean libraryLoaded = false;
static RuntimeLoader<WPIUtilJNI> loader = null;
/** Sets whether JNI should be loaded in the static block. */
public static class Helper {
@@ -42,11 +41,8 @@ public class WPIUtilJNI {
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader =
new RuntimeLoader<>(
"wpiutiljni", RuntimeLoader.getDefaultExtractionRoot(), WPIUtilJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
RuntimeLoader.loadLibrary("wpiutiljni");
} catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
@@ -63,10 +59,7 @@ public class WPIUtilJNI {
if (libraryLoaded) {
return;
}
loader =
new RuntimeLoader<>(
"wpiutiljni", RuntimeLoader.getDefaultExtractionRoot(), WPIUtilJNI.class);
loader.loadLibrary();
RuntimeLoader.loadLibrary("wpiutiljni");
libraryLoaded = true;
}