summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-05-13 21:18:42 +0800
committerGitHub <[email protected]>2025-05-13 21:18:42 +0800
commitd9ec3d392818740f53438151f531150a352d4426 (patch)
tree423a3879401fcfb1defb837a14149fba00be3c8e
parent9b1b539d087eff3e7b62ec700839e2beb7842ebc (diff)
parentb147a04a59b42487386439e046408e48a5504d75 (diff)
Merge pull request #6432 from SirLynix/patch-19
Fix xmake failing to find PING.EXE
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
index 5eeac134b..1c5d0584f 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -77,14 +77,15 @@ function sandbox_lib_detect_find_program._check(program, opt)
opt = opt or {}
local findname = program
if os.subhost() == "windows" then
- if not opt.shell and not program:endswith(".exe") and not program:endswith(".cmd") and not program:endswith(".bat") then
+ local ext = path.extension(program):lower()
+ if not opt.shell and ext ~= ".exe" and ext ~= ".cmd" and ext ~= ".bat" then
findname = program .. ".exe"
end
elseif os.subhost() == "msys" and os.isfile(program) and os.filesize(program) < 256 then
-- only a sh script on msys2? e.g. c:/msys64/usr/bin/7z
-- we need to use sh to wrap it, otherwise os.exec cannot run it
- local program_lower = program:lower()
- if not program_lower:endswith(".exe") and not program_lower:endswith(".cmd") and not program_lower:endswith(".bat") then
+ local ext = path.extension(program):lower()
+ if ext ~= ".exe" and ext ~= ".cmd" and ext ~= ".bat" then
program = "sh " .. program
end
findname = program