summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-02 00:32:14 +0800
committerruki <[email protected]>2021-03-02 00:32:14 +0800
commit8f0fee2899d3fdbca259f32acb068b3a4a45bec6 (patch)
tree5810513c8ffd13fcced87dbfecbbf6b0bb1b8497 /xmake/core/base
parentcbaf212c6befb4e8974aa49be12a99a9fe316f46 (diff)
improve to find_7z and add bzip2
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/os.lua14
-rw-r--r--xmake/core/base/path.lua10
2 files changed, 18 insertions, 6 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ff79aeb96..5f116c35a 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -817,15 +817,17 @@ function os.isexec(filepath)
-- TODO
-- check permission
- -- is *.exe for windows?
+ -- check executable program exist
+ if os.isfile(filepath) then
+ return true
+ end
if os.host() == "windows" then
- if not filepath:endswith(".exe") and not filepath:endswith(".cmd") and not filepath:endswith(".bat") then
- filepath = filepath .. ".exe"
+ for _, suffix in ipairs({".exe", ".cmd", ".bat"}) do
+ if os.isfile(filepath .. suffix) then
+ return true
+ end
end
end
-
- -- file exists?
- return os.isfile(filepath)
end
-- get system host
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index 494961c09..aa0cd571a 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -197,5 +197,15 @@ function path.pattern(pattern)
return pattern
end
+-- get cygwin-style path on msys2/cygwin, e.g. "c:\xxx" -> "/c/xxx"
+function path.cygwin_path(p)
+ p = p:gsub("\\", "/")
+ local pos = p:find(":/")
+ if pos == 2 then
+ return "/" .. p:sub(1, 1) .. p:sub(3)
+ end
+ return p
+end
+
-- return module: path
return path