From e378c025f2965cafe478b4afc83177f10b0c8bf4 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 2 May 2024 03:12:49 -0400 Subject: [PATCH] Force Windows binaries to have .exe extensions Technically, authors really should have their makefiles attached the .exe extension on Windows. But they seldom do. Its easier to add this hack fix, than it is to enforce that standard, and help people debug. Worth noting that this is only an issue for Windows, in shells that don't let you execute files, IE powershell/cmd. --- Client/utils.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Client/utils.py b/Client/utils.py index f526c4b..63f7fad 100644 --- a/Client/utils.py +++ b/Client/utils.py @@ -143,12 +143,20 @@ def engine_binary_name(engine, commit_sha, net_path, private): def check_for_engine_binary(out_path): + # The point of this is to deal with a lacking .exe + assert not out_path.endswith('.exe') + # Check for already having the binary ( Linux ) - if os.path.isfile(out_path): + if IS_LINUX and os.path.isfile(out_path): return out_path # Check for already having the binary ( Windows ) - if os.path.isfile('%s.exe' % (out_path)): + if IS_WINDOWS and os.path.isfile('%s.exe' % (out_path)): + return '%s.exe' % (out_path) + + # Sanity check to force Windows to have .exe extensions + if IS_WINDOWS and os.path.isfile(out_path): + os.rename(out_path, '%s.exe' % (out_path)) return '%s.exe' % (out_path) def makefile_command(net_path, make_path, out_path, compiler):