Skip to content

Commit d9ec3d3

Browse files
authored
Merge pull request #6432 from SirLynix/patch-19
Fix xmake failing to find PING.EXE
2 parents 9b1b539 + b147a04 commit d9ec3d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xmake/core/sandbox/modules/import/lib/detect/find_program.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ function sandbox_lib_detect_find_program._check(program, opt)
7777
opt = opt or {}
7878
local findname = program
7979
if os.subhost() == "windows" then
80-
if not opt.shell and not program:endswith(".exe") and not program:endswith(".cmd") and not program:endswith(".bat") then
80+
local ext = path.extension(program):lower()
81+
if not opt.shell and ext ~= ".exe" and ext ~= ".cmd" and ext ~= ".bat" then
8182
findname = program .. ".exe"
8283
end
8384
elseif os.subhost() == "msys" and os.isfile(program) and os.filesize(program) < 256 then
8485
-- only a sh script on msys2? e.g. c:/msys64/usr/bin/7z
8586
-- we need to use sh to wrap it, otherwise os.exec cannot run it
86-
local program_lower = program:lower()
87-
if not program_lower:endswith(".exe") and not program_lower:endswith(".cmd") and not program_lower:endswith(".bat") then
87+
local ext = path.extension(program):lower()
88+
if ext ~= ".exe" and ext ~= ".cmd" and ext ~= ".bat" then
8889
program = "sh " .. program
8990
end
9091
findname = program

0 commit comments

Comments
 (0)