diff --git a/desktop/build-windows.bat b/desktop/build-windows.bat index 08b639e..1a61675 100644 --- a/desktop/build-windows.bat +++ b/desktop/build-windows.bat @@ -53,7 +53,17 @@ if errorlevel 1 ( ) echo ✅ Build successful -REM ── 6. Signer (optionnel) ───────────────────────────────────── +REM ── 5b. Copier python-embed à côté de l'exécutable pour le dev ───── +echo [5b/6] Copying python-embed to output dir... +set "OUTDIR=target\x86_64-pc-windows-msvc\release" +if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" +xcopy /E /I /Q "python-embed" "%OUTDIR%\python-embed" +REM Copier aussi le backend Python +if not exist "%OUTDIR%\backend" mkdir "%OUTDIR%\backend" +xcopy /E /I /Q "..\backend" "%OUTDIR%\backend" +echo ✅ Runtime copied + +REM ── 6. Résultats ─────────────────────────────────────────────────── echo [6/6] Results: dir /b target\release\bundle\msi\*.msi 2>nul dir /b target\release\bundle\nsis\*.exe 2>nul diff --git a/desktop/src/main.rs b/desktop/src/main.rs index 69cfe33..c0678a9 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -10,10 +10,17 @@ struct BackendProcess(Mutex>); // ── Sidecar : spawn Python backend ────────────────────────────────────────── fn spawn_backend() -> Result { + // Resolve python-embed relative to the executable, not cwd + let exe_dir = std::env::current_exe() + .map_err(|e| format!("Cannot get exe path: {}", e))? + .parent() + .ok_or("Cannot get exe parent dir")? + .to_path_buf(); + let python = if cfg!(target_os = "windows") { - "./python-embed/python.exe" + exe_dir.join("python-embed").join("python.exe") } else { - "./python-embed/bin/python3" + exe_dir.join("python-embed").join("bin").join("python3") }; let child = Command::new(python)