[jffi-next] 21/49: Search both /jni/ and jni/ for the stub lib
Tim Potter
tpot-guest at moszumanska.debian.org
Wed Mar 4 04:51:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
tpot-guest pushed a commit to annotated tag upstream/1.0.10
in repository jffi-next.
commit ed3866ba16f9054f7cb184b5161c3a3bc07bfd6d
Author: Wayne Meissner <wmeissner at gmail.com>
Date: Wed Mar 2 00:12:22 2011 +1000
Search both /jni/ and jni/ for the stub lib
---
src/com/kenai/jffi/Init.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/com/kenai/jffi/Init.java b/src/com/kenai/jffi/Init.java
index fa7a9f0..1a35732 100644
--- a/src/com/kenai/jffi/Init.java
+++ b/src/com/kenai/jffi/Init.java
@@ -170,18 +170,21 @@ final class Init {
* @return A new <tt>InputStream</tt>
*/
private static final InputStream getStubLibraryStream() {
- String path = getStubLibraryPath();
+ String stubPath = getStubLibraryPath();
ClassLoader cl = Init.class.getClassLoader();
- InputStream is = cl.getResourceAsStream(path);
+ InputStream is = null;
- // On MacOS, the stub might be named .dylib or .jnilib - cater for both
- if (is == null && Platform.getPlatform().getOS() == Platform.OS.DARWIN) {
- is = cl.getResourceAsStream(path.replaceAll("dylib", "jnilib"));
- }
+ for (String path : new String[] { stubPath, "/" + stubPath }) {
+ is = cl.getResourceAsStream(path);
+ // On MacOS, the stub might be named .dylib or .jnilib - cater for both
+ if (is == null && Platform.getPlatform().getOS() == Platform.OS.DARWIN) {
+ is = cl.getResourceAsStream(path.replaceAll("dylib", "jnilib"));
+ }
+ }
if (is == null) {
throw new UnsatisfiedLinkError("Could not locate stub library ("
- + path + ") in jar file");
+ + stubPath + ") in jar file");
}
return is;
--
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