Applied a patch from Alec Wysoker for finding snappy DLL via java.library.path

This commit is contained in:
Taro L. Saito 2011-05-26 11:14:01 +09:00
parent 6771e58b46
commit 85d9cc9084
1 changed files with 244 additions and 244 deletions

View File

@ -187,20 +187,20 @@ public class LoadSnappy
// Load the os-dependent library from a jar file
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) == null) {
// use nested VM version
return;
}
if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) {
// Temporary library folder. Use the value of java.io.tmpdir
String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
// Try extracting the library from jar
if (extractAndLoadLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder)) {
isLoaded = true;
return;
}
}
try {
System.loadLibrary("snappy");
isLoaded = true;
} catch (UnsatisfiedLinkError e) {
isLoaded = false;
}
return;
}