Skip to content

Commit 8b46695

Browse files
HanSur94claude
andcommitted
fix: replace temp paths in all MATLAB Engine files, not just _arch.txt
_arch.txt has a multi-value format (4 lines) that we can't recreate. Instead, let setup.py create all files with the correct format (using temp paths), then use PowerShell find-and-replace to swap the temp root with the real MATLAB root across all installed engine files. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent ab15b97 commit 8b46695

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

install.bat

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,11 @@ if %errorlevel% equ 0 (
284284
echo Continuing with MCP server installation...
285285
) else (
286286
echo [OK] MATLAB Engine API installed.
287-
REM Fix _arch.txt — setup.py may have written the temp path or failed to
288-
REM create this file. Create/overwrite it with the real MATLAB bin path.
289-
set "ARCH_DIR=%VENV_DIR%\Lib\site-packages\matlab\engine"
290-
if not exist "!ARCH_DIR!" mkdir "!ARCH_DIR!" 2>nul
291-
echo|set /p="!MATLAB_ROOT!\bin\win64">"!ARCH_DIR!\_arch.txt"
292-
echo [OK] Set MATLAB engine path: !MATLAB_ROOT!\bin\win64
287+
REM Fix _arch.txt and all other files — setup.py wrote temp paths.
288+
REM Replace the temp root with the real MATLAB root in all installed files.
289+
echo Fixing MATLAB engine paths...
290+
powershell -Command "Get-ChildItem -Path '!VENV_DIR!\Lib\site-packages\matlab' -Recurse -File | ForEach-Object { $c = Get-Content $_.FullName -Raw -ErrorAction SilentlyContinue; if ($c -and $c.Contains('!ENGINE_TEMP!')) { $c.Replace('!ENGINE_TEMP!', '!MATLAB_ROOT!') | Set-Content $_.FullName -NoNewline; Write-Host (' Fixed: ' + $_.Name) } }"
291+
echo [OK] MATLAB engine paths fixed to !MATLAB_ROOT!
293292
)
294293
REM Clean up — remove junctions first (rd /s /q follows junctions!)
295294
if exist "!ENGINE_TEMP!\bin" rmdir "!ENGINE_TEMP!\bin" >nul 2>nul

0 commit comments

Comments
 (0)