@@ -41,15 +41,12 @@ private static void loadNativeLibrary(String libName, File cacheDirectory) throw
4141 if (os .contains ("win" )) {
4242 platform = "win-" + arch ;
4343 extension = ".dll" ;
44- libName ="lib" +libName ;
4544 } else if (os .contains ("mac" )) {
4645 platform = "mac-" + arch ;
4746 extension = ".dylib" ;
48- libName ="lib" +libName ;
4947 } else if (os .contains ("nix" ) || os .contains ("nux" ) || os .contains ("aix" )) {
5048 platform = "linux-" + arch ;
5149 extension = ".so" ;
52- libName ="lib" +libName ;
5350 } else {
5451 throw new RuntimeException ("Unsupported OS: " + os );
5552 }
@@ -77,6 +74,12 @@ private static void loadNativeLibrary(String libName, File cacheDirectory) throw
7774 needsCopy = devFile .lastModified () > libFile .lastModified ();
7875
7976 if (needsCopy ) {
77+ // if (devFile.exists()) {
78+ // java.nio.file.Files.copy(devFile.toPath(), libFile.toPath(),
79+ // java.nio.file.StandardCopyOption.REPLACE_EXISTING,
80+ // java.nio.file.StandardCopyOption.COPY_ATTRIBUTES);
81+ // libFile.setExecutable(true);
82+ // } else {
8083 try (java .io .InputStream in = ManifoldBindings .class
8184 .getResourceAsStream ("/manifold3d/natives/" + platform + "/" + fullName )) {
8285 if (in == null )
@@ -86,10 +89,8 @@ private static void loadNativeLibrary(String libName, File cacheDirectory) throw
8689 System .out .println ("Extracted to libs/: " + fullName );
8790 if (cacheDirectory == null )
8891 libFile .deleteOnExit ();
89- }catch (Throwable t ) {
90- throw new RuntimeException ("Failed to load: " + libName , t );
91-
9292 }
93+ // }
9394 } else {
9495 System .out .println ("Copy not performed, already in cache" );
9596 }
@@ -102,8 +103,8 @@ private static void loadNativeLibrary(String libName, File cacheDirectory) throw
102103 }
103104
104105 public static void loadNativeLibrarys (File cacheDirectory ) throws Exception {
105- loadNativeLibrary ("manifold " , cacheDirectory );
106- loadNativeLibrary ("manifoldc " , cacheDirectory );
106+ loadNativeLibrary ("libmanifold " , cacheDirectory );
107+ loadNativeLibrary ("libmanifoldc " , cacheDirectory );
107108 }
108109
109110 public ManifoldBindings () throws Exception {
@@ -112,8 +113,8 @@ public ManifoldBindings() throws Exception {
112113
113114 public ManifoldBindings (File cacheDirectory ) throws Exception {
114115 if (!isNativeLibraryLoaded ()) {
115- loadNativeLibrary ("manifold " , cacheDirectory );
116- loadNativeLibrary ("manifoldc " , cacheDirectory );
116+ loadNativeLibrary ("libmanifold " , cacheDirectory );
117+ loadNativeLibrary ("libmanifoldc " , cacheDirectory );
117118 }
118119
119120 this .library = SymbolLookup .loaderLookup ();
0 commit comments