summaryrefslogtreecommitdiff
path: root/xmake/core/base/path.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-09 00:45:15 +0800
committerruki <[email protected]>2021-03-09 00:45:15 +0800
commitd2bf2df2c3afdf1335721ae37cfeb721ff130227 (patch)
tree5ab9417065ef1b3f90bf32d488f463f5fb66483b /xmake/core/base/path.lua
parent297eac57c0369f473751a88e0b74f7857e74e462 (diff)
improve rules
Diffstat (limited to 'xmake/core/base/path.lua')
-rw-r--r--xmake/core/base/path.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index aa0cd571a..9da3f57c4 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -69,9 +69,12 @@ function path.basename(p)
end
-- get the file extension of the path: .xxx
-function path.extension(p)
+function path.extension(p, level)
local i = p:lastof(".", true)
if i then
+ if level and level > 1 then
+ return path.extension(p:sub(1, i - 1), level - 1) .. p:sub(i)
+ end
return p:sub(i)
else
return ""