Skip to content

Commit 38851d5

Browse files
committed
macOS: copy bundled dylibs to binary dir as well as sketch folder
1 parent 9349bdf commit 38851d5

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

mode/CppMode.jar

114 Bytes
Binary file not shown.

src/java/CppBuild.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,15 @@ public File compile(RunnerListener listener) throws Exception {
604604
String macArch2 = System.getProperty("os.arch","").contains("aarch64") ? "arm64" : "x64";
605605
File macLibsDir2 = new File(runtimeDir.getParentFile(), "libs/macos");
606606
if (macLibsDir2.exists()) {
607+
File macBinaryDir = new File(binary.getParent());
608+
macBinaryDir.mkdirs();
607609
for (File dylib : macLibsDir2.listFiles((d,n) -> n.endsWith(".dylib"))) {
608-
File destDylib = new File(sketch.getFolder(), dylib.getName());
609-
try { java.nio.file.Files.copy(dylib.toPath(), destDylib.toPath(),
610-
java.nio.file.StandardCopyOption.REPLACE_EXISTING); }
611-
catch (Exception ignored) {}
610+
for (File destDir : new File[]{macBinaryDir, sketch.getFolder()}) {
611+
File destDylib = new File(destDir, dylib.getName());
612+
try { java.nio.file.Files.copy(dylib.toPath(), destDylib.toPath(),
613+
java.nio.file.StandardCopyOption.REPLACE_EXISTING); }
614+
catch (Exception ignored) {}
615+
}
612616
}
613617
}
614618
}

0 commit comments

Comments
 (0)