FIX 3 van de Windows:

1. LOAD CHAM: PyInstaller onefile 723MB giai nen toan bo vao %TEMP% moi lan chay -> chuyen ONEDIR (engine.spec COLLECT) + bundle qua Tauri resources (resource_dir/daw_engine/daw_engine.exe) thay externalBin — khoi dong tuc thi khong giai nen
2. WINDOW PICKER: Tauri v2 khong co window.__TAURI__.dialog — goi invoke('plugin:dialog|open', {options:{directory:true}}) qua __TAURI__.core.invoke
3. ICON exe: bundle.icon chuyen icon.ico -> favicon.ico + thay 3 PNG bang favicon render
- build_windows.ps1 buoc 4: copy onedir dist/daw_engine -> src-tauri/resources/daw_engine
This commit is contained in:
2026-08-09 03:30:57 +00:00
parent 466bf25a0b
commit bc8431fe81
9 changed files with 55 additions and 21 deletions
+15 -7
View File
@@ -12,15 +12,23 @@ pub fn run() {
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_dialog::init())
.setup(|app| {
// 1. Spawn sidecar daw_engine.exe (PyInstaller bundle)
let sidecar_command = app
.shell()
.sidecar("daw_engine")
.expect("sidecar daw_engine not found — run build_windows.ps1 first");
let (_rx, child) = sidecar_command
// 1. Spawn daw_engine (PyInstaller ONEDIR bundle — khong giai nen
// moi lan chay nhu onefile, khoi dong nhanh). Bundle qua Tauri
// resources: resource_dir()/daw_engine/daw_engine(.exe)
let res_dir = app
.path()
.resource_dir()
.expect("resource dir not found");
let engine_dir = res_dir.join("daw_engine");
let engine_exe = if cfg!(windows) {
engine_dir.join("daw_engine.exe")
} else {
engine_dir.join("daw_engine")
};
let (_rx, child) = tauri_plugin_shell::process::Command::new(engine_exe)
.env("SF_PARENT_PID", std::process::id().to_string())
.spawn()
.expect("Failed to spawn daw_engine sidecar");
.expect("Failed to spawn daw_engine (onedir resource) — run build_windows.ps1 first");
app.manage(EngineProcess(Mutex::new(Some(child))));
println!("Python Background Engine started (localhost:8000, auto-fallback 8000-8010)");