@echo off setlocal enabledelayedexpansion pushd %~dp0 set "ROOT=%CD%" call "%ROOT%\build.bat" if %ERRORLEVEL% neq 0 ( echo build failed popd exit /b 1 ) set "INSTALL_ROOT=%APPDATA%\kicad\10.0\3rdparty\plugins" set "INSTALL_DIR=%INSTALL_ROOT%\com.jesshunter.layers" if not exist "%INSTALL_ROOT%" mkdir "%INSTALL_ROOT%" >nul 2>&1 rem Preserve user state (state/, cache/, logs/, settings.json) across reinstall. if exist "%INSTALL_DIR%\bin" rmdir /s /q "%INSTALL_DIR%\bin" if exist "%INSTALL_DIR%\resources" rmdir /s /q "%INSTALL_DIR%\resources" if exist "%INSTALL_DIR%\plugin.json" del /q "%INSTALL_DIR%\plugin.json" if exist "%INSTALL_DIR%\LICENCE" del /q "%INSTALL_DIR%\LICENCE" set "STAGE=%ROOT%\build\bin\com.jesshunter.layers" xcopy /e /i /y /q "%STAGE%" "%INSTALL_DIR%" >nul echo installed: %INSTALL_DIR% popd endlocal