From f65be5c57295c485dedf1fa6de1f18f1bc18d46b Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 12 Feb 2024 16:20:15 -0500 Subject: [PATCH] Various fixes for Windows ( and maybe Linux ) using Make to tell the compiler to produce a binary to the /Engines/ dir fails on Windows when the tmpfs is not on the same disk as the Client. This might have also occured on Windows. shutil resolves that. Take extra care to always maintain the possible .exe extension on files when doing this. This is done twice in the shutil line; first making sure to pickup the true file output name, and secondly to only use the root of the out_path and not the basename --- Client/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Client/utils.py b/Client/utils.py index 35924a5..3900ac0 100644 --- a/Client/utils.py +++ b/Client/utils.py @@ -294,15 +294,19 @@ def download_public_engine(engine, net_path, branch, source, make_path, out_path os.rename(unzip_root, src_path) # Prepare the MAKEFILE command - make_path = os.path.join(src_path, make_path) - rel_out_path = os.path.relpath(os.path.abspath(out_path), make_path) - make_cmd = makefile_command(net_path, make_path, rel_out_path, compiler) + make_path = os.path.join(src_path, make_path) + bin_path = os.path.join(make_path, os.path.basename(out_path)) + make_cmd = makefile_command(net_path, make_path, bin_path, compiler) - # Build the engine, which will produce a binary to the original out_path + # Build the engine, which will produce a binary to bin_path, to be moved after process = subprocess.Popen(make_cmd, cwd=make_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) comp_output = process.communicate()[0].decode('utf-8') - # Check to see if we already have the binary + # Move the binary to the proper out_path, account for Windows and cross-drive moves + if check_for_engine_binary(bin_path): + shutil.move(check_for_engine_binary(bin_path), os.path.dirname(out_path)) + + # Check to see if we have the binary if check_for_engine_binary(out_path): return os.path.basename(check_for_engine_binary(out_path))