Skip to content

Commit e347e27

Browse files
committed
Fix bundled headers in linter: Windows only, skip on Linux/macOS with system GLFW
1 parent b6de148 commit e347e27

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

mode/CppMode.jar

173 Bytes
Binary file not shown.

src/java/CppLinter.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,16 @@ private void runCheck(Sketch sketch, int currentTab, String liveText) {
167167
cmd.add(runtimeDir.getAbsolutePath());
168168
// Bundled headers (GLFW, GLEW)
169169
File bundledInc = new File(runtimeDir.getParentFile(), "libs/include");
170-
if (bundledInc.exists()) { cmd.add("-I"); cmd.add(bundledInc.getAbsolutePath()); }
170+
boolean isWinLint = System.getProperty("os.name","").toLowerCase().contains("win");
171+
if (bundledInc.exists() && isWinLint) {
172+
cmd.add("-I"); cmd.add(bundledInc.getAbsolutePath());
173+
} else if (bundledInc.exists()) {
174+
// Linux/macOS: only use bundled headers if system GLFW missing
175+
boolean hasSystemGlfw = new java.io.File("/usr/include/GLFW/glfw3.h").exists()
176+
|| new java.io.File("/usr/local/include/GLFW/glfw3.h").exists()
177+
|| new java.io.File("/opt/homebrew/include/GLFW/glfw3.h").exists();
178+
if (!hasSystemGlfw) { cmd.add("-I"); cmd.add(bundledInc.getAbsolutePath()); }
179+
}
171180
if (gch != null) {
172181
cmd.add("-I");
173182
cmd.add(gch.getParentFile().getAbsolutePath());

0 commit comments

Comments
 (0)