[jffi-next] 17/24: If jffi.boot.library.path is not set, try to get the property from /com/kenai/jffi/boot.properties
Tim Potter
tpot-guest at moszumanska.debian.org
Wed Mar 4 04:51:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
tpot-guest pushed a commit to tag 0.6.5
in repository jffi-next.
commit 8b73fd8c564c4763577d7e7d254dff6142474a55
Author: Wayne Meissner <wmeissner at gmail.com>
Date: Mon Jan 25 18:46:04 2010 +1000
If jffi.boot.library.path is not set, try to get the property from /com/kenai/jffi/boot.properties
---
src/com/kenai/jffi/Init.java | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/com/kenai/jffi/Init.java b/src/com/kenai/jffi/Init.java
index afb9c2c..004a5f7 100644
--- a/src/com/kenai/jffi/Init.java
+++ b/src/com/kenai/jffi/Init.java
@@ -26,11 +26,14 @@ import java.io.InputStream;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
+import java.util.Properties;
/**
* Utility class to load the jffi stub library
*/
final class Init {
+ private static final String bootPropertyFilename = "boot.properties";
+ private static final String bootLibraryPropertyName = "jffi.boot.library.path";
private static final String stubLibraryName
= String.format("jffi-%d.%d", Foreign.VERSION_MAJOR, Foreign.VERSION_MINOR);
/**
@@ -48,7 +51,7 @@ final class Init {
*/
private static final void load() {
final String libName = getStubLibraryName();
- String bootPath = System.getProperty("jffi.boot.library.path");
+ String bootPath = getBootPath();
if (bootPath != null && loadFromBootPath(libName, bootPath)) {
return;
}
@@ -61,6 +64,25 @@ final class Init {
loadFromJar();
}
+ private static final String getBootPath() {
+
+ String bootPath = System.getProperty(bootLibraryPropertyName);
+ if (bootPath != null) {
+ return bootPath;
+ }
+
+ InputStream is = Init.class.getResourceAsStream(bootPropertyFilename);
+ if (is != null) {
+ Properties p = new Properties();
+ try {
+ p.load(is);
+ return p.getProperty(bootLibraryPropertyName);
+ } catch (IOException ex) { }
+ }
+
+ return null;
+ }
+
private static final boolean loadFromBootPath(String libName, String bootPath) {
String[] dirs = bootPath.split(File.pathSeparator);
for (int i = 0; i < dirs.length; ++i) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jffi-next.git
More information about the pkg-java-commits
mailing list