forked from I2P_Developers/i2p.i2p
jbigi: Save and report extracted library name
This commit is contained in:
@@ -96,9 +96,11 @@ import net.i2p.crypto.CryptoConstants;
|
||||
*/
|
||||
public class NativeBigInteger extends BigInteger {
|
||||
/** did we load the native lib correctly? */
|
||||
private static boolean _nativeOk = false;
|
||||
private static boolean _nativeOk;
|
||||
private static String _loadStatus = "uninitialized";
|
||||
private static String _cpuModel = "uninitialized";
|
||||
private static String _extractedResource;
|
||||
|
||||
/**
|
||||
* do we want to dump some basic success/failure info to stderr during
|
||||
* initialization? this would otherwise use the Log component, but this makes
|
||||
@@ -340,10 +342,24 @@ public class NativeBigInteger extends BigInteger {
|
||||
return _nativeOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A string suitable for display to the user
|
||||
*/
|
||||
public static String loadStatus() {
|
||||
return _loadStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the library loaded, if known.
|
||||
* Null if unknown or not loaded.
|
||||
* Currently non-null only if extracted from jbigi.jar.
|
||||
*
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public static String getLoadedResourceName() {
|
||||
return _extractedResource;
|
||||
}
|
||||
|
||||
public static String cpuType() {
|
||||
if (sCPUType != null)
|
||||
return sCPUType;
|
||||
@@ -459,7 +475,11 @@ public class NativeBigInteger extends BigInteger {
|
||||
boolean loaded = loadGeneric("jbigi");
|
||||
if (loaded) {
|
||||
_nativeOk = true;
|
||||
info("Locally optimized native BigInteger library loaded from file");
|
||||
String s = I2PAppContext.getGlobalContext().getProperty("jbigi.loadedResource");
|
||||
if (s != null)
|
||||
info("Locally optimized library " + s + " loaded from file");
|
||||
else
|
||||
info("Locally optimized native BigInteger library loaded from file");
|
||||
} else {
|
||||
List<String> toTry = getResourceList();
|
||||
debug("loadResource list to try is: " + toTry);
|
||||
@@ -467,6 +487,7 @@ public class NativeBigInteger extends BigInteger {
|
||||
debug("trying loadResource " + s);
|
||||
if (loadFromResource(s)) {
|
||||
_nativeOk = true;
|
||||
_extractedResource = s;
|
||||
info("Native BigInteger library " + s + " loaded from resource");
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user