mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-28 00:14:15 +02:00
Applied a patch from Alec Wysoker for finding snappy DLL via java.library.path
This commit is contained in:
parent
6771e58b46
commit
85d9cc9084
@ -187,20 +187,20 @@ public class LoadSnappy
|
|||||||
// Load the os-dependent library from a jar file
|
// Load the os-dependent library from a jar file
|
||||||
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
|
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
|
||||||
|
|
||||||
if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) == null) {
|
if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) {
|
||||||
// use nested VM version
|
// Temporary library folder. Use the value of java.io.tmpdir
|
||||||
return;
|
String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
|
||||||
|
// Try extracting the library from jar
|
||||||
|
if (extractAndLoadLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
// Temporary library folder. Use the value of java.io.tmpdir
|
System.loadLibrary("snappy");
|
||||||
String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
|
|
||||||
// Try extracting the library from jar
|
|
||||||
if (extractAndLoadLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder)) {
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
return;
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
isLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoaded = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user