From 979dfc605dfd6eaabd0e08bcbdd9c3be59d904a8 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Thu, 10 Apr 2025 10:12:22 +0000 Subject: [PATCH] Update leenkx/blender/lnx/make.py --- leenkx/blender/lnx/make.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/leenkx/blender/lnx/make.py b/leenkx/blender/lnx/make.py index 9f80de2..3d16358 100644 --- a/leenkx/blender/lnx/make.py +++ b/leenkx/blender/lnx/make.py @@ -694,8 +694,8 @@ def build_success(): if wrd.lnx_audio == 'Disabled': cmd.append('--nosound') - elif state.target.startswith(('windows-hl', 'linux-hl', 'macos-hl', 'Hashlink')): - log.info(f"Attempting to run Hashlink/C target: {state.target}") + elif state.target.startswith(('windows-hl', 'linux-hl', 'macos-hl')): + log.info(f"Runtime Hashlink/C target: {state.target}") hl_build_dir, _, _ = lnx.utils.hashlink_paths(state.target) @@ -763,7 +763,6 @@ def build_success(): if not compile_success: return - # Path is typically: ///.exe exe_path = os.path.join(hl_build_dir, platform, build_mode, proj_name + '.exe') if not os.path.isfile(exe_path): exe_path = os.path.join(hl_build_dir, build_mode, proj_name + '.exe') @@ -772,10 +771,17 @@ def build_success(): return log.info(f"Found compiled executable: {exe_path}") - cmd = [exe_path] - exe_dir = os.path.dirname(exe_path) - log.info(f"Changing CWD to: {exe_dir}") - os.chdir(exe_dir) + + dest_exe_name = proj_name + '.exe' + base_build_dir = lnx.utils.get_fp_build() + dest_dir = os.path.join(base_build_dir, state.target) + dest_path = os.path.join(dest_dir, dest_exe_name) + try: + shutil.move(exe_path, dest_path) + cmd = [dest_path] + except Exception as e: + cmd = [exe_path] + os.chdir(dest_dir) elif state.target in ('linux-hl', 'macos-hl'): log.error(f"Compilation for {state.target} is not yet implemented in build_success.") @@ -784,15 +790,6 @@ def build_success(): log.error(f"Running logic for target {state.target} is not defined (expected Krom or Hashlink/C).") return - if cmd: - log.info(f"Executing final command: {' '.join(cmd)}") - try: - state.proc_play = run_proc(cmd, play_done) - except Exception: - traceback.print_exc() - else: - log.error("No command generated to run.") - try: state.proc_play = run_proc(cmd, play_done) except Exception: