diff --git a/src/native/libhwoio.so b/src/native/libhwoio.so deleted file mode 100644 index b88bef6..0000000 Binary files a/src/native/libhwoio.so and /dev/null differ diff --git a/src/native/libhwoio32.so b/src/native/linux32/libhwoio.so similarity index 100% rename from src/native/libhwoio32.so rename to src/native/linux32/libhwoio.so diff --git a/src/native/libnsp32.so b/src/native/linux32/libnsp.so similarity index 100% rename from src/native/libnsp32.so rename to src/native/linux32/libnsp.so diff --git a/src/native/libnsp64.so b/src/native/linux64/libnsp.so similarity index 100% rename from src/native/libnsp64.so rename to src/native/linux64/libnsp.so diff --git a/src/native/hwoio32.dll b/src/native/mswin32/hwoio.dll similarity index 100% rename from src/native/hwoio32.dll rename to src/native/mswin32/hwoio.dll diff --git a/src/native/nsp32.dll b/src/native/mswin32/nsp.dll similarity index 100% rename from src/native/nsp32.dll rename to src/native/mswin32/nsp.dll diff --git a/src/native/libhwoio.dylib b/src/native/osx32/libhwoio.dylib similarity index 100% rename from src/native/libhwoio.dylib rename to src/native/osx32/libhwoio.dylib diff --git a/src/org/hwo/nativeloader/NativeLoader.java b/src/org/hwo/nativeloader/NativeLoader.java deleted file mode 100644 index 6a364ba..0000000 --- a/src/org/hwo/nativeloader/NativeLoader.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.hwo.nativeloader; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream.GetField; -import java.io.OutputStream; - -import javax.management.RuntimeErrorException; - -import org.hwo.os.OsDetect; -import org.hwo.os.OsDetect.Bitness; -import org.hwo.os.OsDetect.OsType; - -public class NativeLoader { - - private static boolean patchedLinux = false; - - private static String calculateLibraryName(String libName){ - - String platformLibName; - - if (OsDetect.getBitness()==Bitness.B32){ - libName = libName + "32"; - } - if (OsDetect.getBitness()==Bitness.B64){ - libName = libName + "64"; - } - - switch (OsDetect.getOperatingSystem()) - { - case LINUX: - platformLibName = String.format("lib%s.so",libName); - break; - case OSX: - platformLibName = String.format("lib%s.dylib",libName); - break; - case WINDOWS: - platformLibName = String.format("%s.dll",libName); - break; - default: - throw new RuntimeException("Betriebssystem nicht unterst�tzt!"); - } - - return platformLibName; - - } - - public static boolean tryLoad(String libName){ - try - { - System.loadLibrary(libName); - return true; - } catch (UnsatisfiedLinkError e) - { - System.err.println(""); - System.err.println(""); - System.err.println("** tryLoad(...) A *****************************"); - System.err.println(""); - e.printStackTrace(); - - - try - { - System.load(libName); - return true; - } catch (UnsatisfiedLinkError ee) - { - System.err.println(""); - System.err.println(""); - System.err.println("** tryLoad(...) B *****************************"); - System.err.println(""); - ee.printStackTrace(); - } - } - return false; - } - - public static void loadLibrary(String libName) - { - //if (OsDetect.getOperatingSystem()==OsType.LINUX){ - // System.err.println("Linux erkannt. Patche java.library.path"); - System.setProperty("java.library.path",String.format(".:%s",System.getProperty("java.library.path"))); - //} - - - if (tryLoad(libName)) - return; - - String platformLibName = calculateLibraryName(libName); - if (tryLoad(platformLibName)) - return; - - if (tryLoad(new File("").getAbsolutePath() + File.separator + platformLibName)) - return; - - String resourcePath; - - System.err.println(String.format("NativeLoader: Platform dependent Name: %s",platformLibName)); - - resourcePath = "/native/" + platformLibName; - System.err.println(String.format("NativeLoader: Resource name: %s",resourcePath)); - - InputStream libInputStream = NativeLoader.class.getResourceAsStream(resourcePath); - if (libInputStream == null) - { - System.err.println("Resource wurde nicht gefunden!"); - } - - try { - File tempLibFile = File.createTempFile("native-", platformLibName); - FileOutputStream fos = new FileOutputStream(tempLibFile); - - System.err.println(String.format("Using Temp File: %s",tempLibFile.getAbsoluteFile())); - System.err.println(String.format("Size: %d",libInputStream.available())); - - byte[] buffer = new byte[libInputStream.available()]; - libInputStream.read(buffer); - fos.write(buffer); - fos.close(); - - System.err.println(String.format("Loading: %s", tempLibFile.getAbsolutePath())); - System.load(tempLibFile.getAbsolutePath()); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - - } - - } - - -}