Skip to content

Commit 92e48e6

Browse files
committed
Windows: add sketch folder and WinLibs bin to PATH when launching sketch
1 parent 051b143 commit 92e48e6

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

mode/CppMode.jar

224 Bytes
Binary file not shown.

src/java/CppRunner.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@ public void launch() {
4040
// On Windows, add bundled DLL directory to PATH so the exe finds them at runtime
4141
String osName = System.getProperty("os.name", "").toLowerCase();
4242
if (osName.contains("win") && runtimeDir != null) {
43+
String existingPath = pb.environment().getOrDefault("PATH", "");
44+
StringBuilder winPath = new StringBuilder();
45+
// Add sketch folder first (DLLs are copied here)
46+
winPath.append(sketchFolder.getAbsolutePath()).append(";");
47+
// Add WinLibs portable gcc bin (compiler runtime DLLs)
48+
File portableBin = new File(System.getenv("APPDATA") + "\\CppMode\\gcc\\mingw64\\bin");
49+
if (portableBin.exists()) winPath.append(portableBin.getAbsolutePath()).append(";");
50+
// Add bundled libs
4351
File bundledLibs = new File(runtimeDir.getParentFile(), "libs/windows-x64");
44-
if (bundledLibs.exists()) {
45-
String existingPath = pb.environment().getOrDefault("PATH", "");
46-
pb.environment().put("PATH", bundledLibs.getAbsolutePath() + ";" + existingPath);
47-
}
52+
if (bundledLibs.exists()) winPath.append(bundledLibs.getAbsolutePath()).append(";");
53+
winPath.append(existingPath);
54+
pb.environment().put("PATH", winPath.toString());
4855
}
4956
pb.environment().put("PROCESSING_SKETCH_NAME", sketchFolder.getName());
5057
pb.environment().put("PROCESSING_SKETCH_PATH",

0 commit comments

Comments
 (0)