Skip to content

Commit

Permalink
Pushing changes for new manifest approach that should solve the stran…
Browse files Browse the repository at this point in the history
…ge behavior on OSX.
  • Loading branch information
kwhat committed Sep 14, 2014
1 parent 3a498b6 commit 2a064a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/java/org/jnativehook/GlobalScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.net.URL;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand All @@ -41,6 +42,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.jar.Attributes;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import java.util.logging.Logger;

Expand Down Expand Up @@ -521,12 +523,12 @@ private static void loadNativeLibrary() {
if (libInputStream != null) {
try {
// Try and load the Jar manifest as a resource stream.
InputStream manInputStream = GlobalScreen.class.getResourceAsStream("/META-INF/MANIFEST.MF");
if (manInputStream != null) {
// Try and extract a version string from the Manifest.
Manifest manifest = new Manifest(manInputStream);
URL jarFile = GlobalScreen.class.getProtectionDomain().getCodeSource().getLocation();
JarInputStream jarInputStream = new JarInputStream(jarFile.openStream());

// FIXME More OS X JRE Bugs! This returns NULL but only for Apple!
// Try and extract a version string from the Manifest.
Manifest manifest = jarInputStream.getManifest();
if (manifest != null) {
Attributes attributes = manifest.getAttributes(basePackage);

if (attributes != null) {
Expand Down

0 comments on commit 2a064a5

Please sign in to comment.