diff --git a/xmake/modules/private/utils/executable_path.lua b/xmake/modules/private/utils/executable_path.lua index f410d9a00e0..b79927277d9 100644 --- a/xmake/modules/private/utils/executable_path.lua +++ b/xmake/modules/private/utils/executable_path.lua @@ -50,6 +50,14 @@ function main(program) end end end + -- patch .exe + -- @see https://github.com/xmake-io/xmake/discussions/4781 + if is_host("windows") and path.is_absolute(program) then + local program_exe = program .. ".exe" + if os.isfile(program_exe) then + program = program_exe + end + end if not filepath then filepath = program end