Added a convention to check if it's v1 of the library (which is necessary on some platforms)
This commit is contained in:
parent
409f1f7410
commit
6ece94345d
|
@ -16,14 +16,36 @@
|
|||
|
||||
package dorkbox.util.jna.linux;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
/**
|
||||
* Helper for AppIndicator, because it is absolutely mindboggling how those whom maintain the standard, can't agree to what that standard
|
||||
* library naming convention or features rae is. We just try until we find one that work, and are able to map the symbols we need.
|
||||
* library naming convention or features set is. We just try until we find one that work, and are able to map the symbols we need.
|
||||
*/
|
||||
public
|
||||
class AppIndicatorQuery {
|
||||
public static
|
||||
Object get_v1() {
|
||||
// version 1 is better than version 3, because of dumb shit redhat did.
|
||||
// to wit, installing the google chrome browser, will ALSO install the correct appindicator library.
|
||||
try {
|
||||
Object appindicator = Native.loadLibrary("appindicator", Library.class);
|
||||
if (appindicator != null) {
|
||||
String s = appindicator.toString();
|
||||
// make sure it's actually v1. If it's NOT v1 (ie: v3) then fallback to GTK version
|
||||
if (s.indexOf(".so.1") < 1) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return appindicator;
|
||||
} catch (Throwable ignored) {
|
||||
ignored.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static
|
||||
Object get() {
|
||||
Object library;
|
||||
|
@ -37,6 +59,8 @@ class AppIndicatorQuery {
|
|||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
// whoops. Symbolic links are bugged out. Look manually for it...
|
||||
|
||||
// version 1 is better than version 3, because of dumb shit redhat did.
|
||||
try {
|
||||
library = Native.loadLibrary("appindicator1", AppIndicator.class);
|
||||
|
|
Loading…
Reference in New Issue
Block a user