File lejos_nxj-library-path.patch of Package lejos_nxj

diff -ruN leJOS_NXJ_0.9.1beta-3_source.orig/pccomms/src/lejos/internal/jni/JNILoader.java leJOS_NXJ_0.9.1beta-3_source/pccomms/src/lejos/internal/jni/JNILoader.java
--- leJOS_NXJ_0.9.1beta-3_source.orig/pccomms/src/lejos/internal/jni/JNILoader.java	2012-05-29 00:13:55.000000000 +0200
+++ leJOS_NXJ_0.9.1beta-3_source/pccomms/src/lejos/internal/jni/JNILoader.java	2012-07-10 12:17:07.000680570 +0200
@@ -99,6 +99,29 @@
 		String os = osinfo.getOS();
 		File folder = new File(new File(basefolder, os), arch);
 
+		// try linux standard lib path
+		if("linux".equals(os))
+		{
+			File libpath = new File("/usr"+("x86".equals(arch)?"/lib":"/lib64"),libfile);
+			if(libpath.exists())
+			{
+				String libpath2 = libpath.getAbsolutePath();
+				try
+				{
+					System.load(libpath2);
+					return;
+				}
+				catch(Exception e)
+				{
+					throw new JNIException("cannot load library " + libpath2, e);
+				}
+				catch (UnsatisfiedLinkError e)
+				{
+					throw new JNIException("cannot load library " + libpath2, e);
+				}
+			}
+		}
+
 		// try to find libfile in basefolder/os/arch, basefolder/os, and basefolder
 		for (int i = 0; i < 3; i++)
 		{
openSUSE Build Service is sponsored by