From f71ec03e79bcae83bca4cee16e21a6d198b36493 Mon Sep 17 00:00:00 2001 From: Adam Tombleson Date: Tue, 5 May 2026 21:23:38 +0545 Subject: [PATCH] fix: use import.meta.url for cross-platform script path resolution Hardcoded Windows path broke Linux/macOS startup. Use import.meta.url to derive the script path relative to the compiled JS, with KICAD_SCRIPT_PATH env override for custom installs. Co-Authored-By: Claude Sonnet 4.6 --- src/kicad-server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kicad-server.ts b/src/kicad-server.ts index f77bcac..5cd4ed0 100644 --- a/src/kicad-server.ts +++ b/src/kicad-server.ts @@ -24,8 +24,8 @@ class KiCADServer { constructor() { // Set absolute path to the Python KiCAD interface script - // Using a hardcoded path to avoid cwd() issues when running from Cline - this.kicadScriptPath = "c:/repo/KiCAD-MCP/python/kicad_interface.py"; + this.kicadScriptPath = process.env.KICAD_SCRIPT_PATH || + path.join(path.dirname(new URL(import.meta.url).pathname), "../python/kicad_interface.py"); // Check if script exists if (!existsSync(this.kicadScriptPath)) {