diff options
| author | Saikari <[email protected]> | 2026-01-28 11:14:05 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-01-28 11:14:05 +0300 |
| commit | c1a0fd840c94e54aab5317bd65b5e2f4dbca947d (patch) | |
| tree | 68473b4beb9c7605c1646df1d4c144f5b2192588 /xmake/core/base/os.lua | |
| parent | e1d3f3555235dc41e530f563140850a3ee8b3e2b (diff) | |
Add os.access function for file access checking
Diffstat (limited to 'xmake/core/base/os.lua')
| -rw-r--r-- | xmake/core/base/os.lua | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index dcd5ab5d1..a752b7a42 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -46,6 +46,7 @@ os._getenvs = os._getenvs or os.getenvs os._cpuinfo = os._cpuinfo or os.cpuinfo os._meminfo = os._meminfo or os.meminfo os._readlink = os._readlink or os.readlink +os._access = os._access or os.access -- syserror code os.SYSERR_UNKNOWN = -1 @@ -1155,15 +1156,9 @@ function os.isexec(filepath) -- check executable program exist if os.isfile(filepath) then - return true - end - if os.host() == "windows" then - for _, suffix in ipairs({".exe", ".cmd", ".bat"}) do - if os.isfile(filepath .. suffix) then - return true - end - end + return os._access(filepath, "x") end + return false end -- get system host |
