OSDN Git Service

[fixed] JoglNativesLoader. NAAAAAATTTEEE!!!!11!!1One :p If we ever update the lwjgl...
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Wed, 19 Jan 2011 11:19:40 +0000 (11:19 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Wed, 19 Jan 2011 11:19:40 +0000 (11:19 +0000)
backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglNativesLoader.java

index 4e14c35..d5a585e 100644 (file)
@@ -50,14 +50,14 @@ public class JoglNativesLoader {
                String os = System.getProperty("os.name");\r
                boolean is64Bit = System.getProperty("os.arch").equals("amd64");\r
                if (os.contains("Windows")) {\r
-                       load("/native/windows/", is64Bit ? "lwjgl64.dll" : "lwjgl.dll");\r
-                       load("/native/windows/", is64Bit ? "OpenAL64.dll" : "OpenAL32.dll");\r
+                       load("/native/windows/", is64Bit ? "lwjgl64.dll" : "lwjgl.dll", false);\r
+                       load("/native/windows/", is64Bit ? "OpenAL64.dll" : "OpenAL32.dll", false);\r
                } else if (os.contains("Linux")) {\r
-                       load("/native/linux/", is64Bit ? "liblwjgl64.so" : "liblwjgl.so");\r
-                       load("/native/linux/", is64Bit ? "libopenal64.so" : "libopenal.so");\r
+                       load("/native/linux/", is64Bit ? "liblwjgl64.so" : "liblwjgl.so", false);\r
+                       load("/native/linux/", is64Bit ? "libopenal64.so" : "libopenal.so", false);\r
                } else if (os.contains("Mac")) {\r
-                       load("/native/macosx/", "liblwjgl.jnilib");\r
-                       load("/native/macosx/", "libopenal.dylib");\r
+                       load("/native/macosx/", "liblwjgl.jnilib", false);\r
+                       load("/native/macosx/", "libopenal.dylib", false);\r
                }\r
                System.setProperty("org.lwjgl.librarypath", new File(System.getProperty("java.io.tmpdir")).getAbsolutePath());\r
 \r
@@ -94,11 +94,11 @@ public class JoglNativesLoader {
                if (os.contains("Mac")) {\r
                        library = "lib" + resource + ".jnilib";\r
                }\r
-               load(package_path, library);\r
+               load(package_path, library, true);\r
        }\r
 \r
-       private static void load (String package_path, String library) {\r
-               String so = System.getProperty("java.io.tmpdir") + "/" + System.nanoTime() + library;\r
+       private static void load (String package_path, String library, boolean stamped) {\r
+               String so = System.getProperty("java.io.tmpdir") + "/" + (stamped?System.nanoTime():"") + library;\r
                InputStream in = JoglGraphics.class.getResourceAsStream(package_path + library);\r
                if (in == null) throw new RuntimeException("couldn't find " + library + " in jar file.");\r
 \r
@@ -115,7 +115,8 @@ public class JoglNativesLoader {
                        in.close();\r
                        System.load(so);\r
                } catch (FileNotFoundException e) {\r
-                       throw new RuntimeException("couldn't write " + library + " to temporary file " + so);\r
+                       if(stamped)\r
+                               throw new RuntimeException("couldn't write " + library + " to temporary file " + so);\r
                } catch (IOException e) {\r
                        throw new RuntimeException("couldn't write " + library + " to temporary file " + so);\r
                }\r