summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-01-28 19:26:04 +0300
committerSaikari <[email protected]>2026-01-28 19:26:04 +0300
commita45f1db67258d65543be7f6272e7fe994a3c354c (patch)
tree38f3622c2cc809ea42bef80028899c22870178ab
parentfa12bdfd81c297fecb611789020058a87c52eb16 (diff)
Refine os.isexec function to improve architecture checks for Windows executables
-rw-r--r--xmake/core/base/os.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index c8526837a..28e9ad968 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -1165,8 +1165,14 @@ function os.isexec(filepath)
local peinfo = io.parse_pe(filepath)
if peinfo then
local pe_arch = peinfo.arch
- -- x64 or x86
- if pe_arch == "x86" or pe_arch == "x64" and os.is_arch("x86_64") then
+ -- x86
+ if pe_arch == "x86" and os.is_arch("x86_64", "i686") then
+ return true
+ else
+ return false
+ end
+ -- x64
+ if pe_arch == "x64" and os.is_arch("x86_64") then
return true
else
return false
@@ -1198,8 +1204,14 @@ function os.isexec(filepath)
local peinfo = io.parse_pe(filepath .. ".exe")
if peinfo then
local pe_arch = peinfo.arch
- -- x64 or x86
- if pe_arch == "x86" or pe_arch == "x64" and os.is_arch("x86_64") then
+ -- x86
+ if pe_arch == "x86" and os.is_arch("x86_64", "i686") then
+ return true
+ else
+ return false
+ end
+ -- x64
+ if pe_arch == "x64" and os.is_arch("x86_64") then
return true
else
return false