From 0334c2a5a3679da35427732383a497720e4389e3 Mon Sep 17 00:00:00 2001 From: locphamtran Date: Wed, 19 Aug 2026 08:15:59 +0700 Subject: [PATCH] fix(backend): find_bridge_exe frozen onedir thieu exe_dir candidate - bridge sidecar nam canh app root ngoai _MEIPASS lam list_fx tra rong (Mastering/FX Rack khong load VST duoc); mirror logic runtime._vst_render_available --- app/core/native_render.py | 7 +++++++ app/core/runtime.py | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/core/native_render.py b/app/core/native_render.py index 8c397b2..b49ea21 100644 --- a/app/core/native_render.py +++ b/app/core/native_render.py @@ -32,6 +32,13 @@ def find_bridge_exe() -> str: if root: cands += [os.path.join(root, "binaries", BRIDGE_EXE), os.path.join(root, BRIDGE_EXE)] + # PyInstaller onedir: daw_engine.exe nam /daw_engine/, bridge + # sidecar nam canh app root (khong trong _MEIPASS) - tim ca exe_dir. + exe_dir = os.path.dirname(os.path.abspath(sys.executable)) + cands += [os.path.join(exe_dir, "binaries", BRIDGE_EXE), + os.path.join(exe_dir, BRIDGE_EXE), + os.path.join(os.path.dirname(exe_dir), "binaries", BRIDGE_EXE), + os.path.join(os.path.dirname(exe_dir), BRIDGE_EXE)] cands.append(os.path.join(settings.BASE_DIR, "install", BRIDGE_EXE)) for p in cands: if p and os.path.isfile(p): diff --git a/app/core/runtime.py b/app/core/runtime.py index 2d7ca87..29ef489 100644 --- a/app/core/runtime.py +++ b/app/core/runtime.py @@ -381,7 +381,16 @@ def _vst_render_available() -> bool: if env and os.path.isfile(env): return True exe = "daw_vst_bridge.exe" if os.name == "nt" else "daw_vst_bridge" - return os.path.isfile(os.path.join(settings.BASE_DIR, "install", exe)) + if os.path.isfile(os.path.join(settings.BASE_DIR, "install", exe)): + return True + # Frozen onedir: bridge sidecar nam canh app root (ngoai _MEIPASS) + if getattr(sys, "frozen", False): + exe_dir = os.path.dirname(os.path.abspath(sys.executable)) + for cand in (os.path.join(exe_dir, exe), + os.path.join(os.path.dirname(exe_dir), exe)): + if os.path.isfile(cand): + return True + return False def _lan_info() -> dict: