summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-30 22:43:42 +0800
committerruki <[email protected]>2026-01-30 22:43:42 +0800
commit5c268c235f35b40a768a7df72988a5db6414fc4d (patch)
treeae1e07658c5b220a85de2e5f3415084deda87c6a
parent8a9d19e08aea07be760882d629fa90f4ab7c2da3 (diff)
fix os.isexec
-rw-r--r--xmake/core/base/os.lua17
1 files changed, 8 insertions, 9 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ba3feca2d..f4cdee611 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -1154,20 +1154,19 @@ function os.isexec(filepath)
if os.host() == "windows" then
local exts = {".exe", ".com", ".cmd", ".bat", ".ps1", ".sh"}
if os.isfile(filepath) then
- -- detect file extension first
local extension = path.extension(filepath):lower()
if extension then
if table.contains(exts, extension) then
return true
end
- end
-
- local format = nil
- if binutils and binutils.format then
- format = binutils.format(filepath)
- end
- if format == "pe" or format == "ape" or format == "shebang" then
- return true
+ else
+ local format = nil
+ if binutils and binutils.format then
+ format = binutils.format(filepath)
+ end
+ if format == "pe" or format == "ape" or format == "shebang" then
+ return true
+ end
end
end
for _, suffix in ipairs(exts) do