diff options
| author | OpportunityLiu <[email protected]> | 2019-06-18 08:28:35 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-06-18 08:28:35 +0800 |
| commit | 9c8b83a61fce275edd3808c54f36ba368378fa5d (patch) | |
| tree | 13c33fc09353745d706bfccbc7e7fba9531b24ce /xmake/core/base/path.lua | |
| parent | 284857c1a43ce61a9f5433d88414e539f2bdc02a (diff) | |
Support clang as cuda compiler
Diffstat (limited to 'xmake/core/base/path.lua')
| -rw-r--r-- | xmake/core/base/path.lua | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua index 489f6b702..9499799f1 100644 --- a/xmake/core/base/path.lua +++ b/xmake/core/base/path.lua @@ -27,6 +27,10 @@ local string = require("base/string") -- get the directory of the path function path.directory(p) + + -- check + assert(p) + local i = p:find_last("[/\\]") if i then if i > 1 then i = i - 1 end @@ -38,6 +42,10 @@ end -- get the filename of the path function path.filename(p) + + -- check + assert(p) + local i = p:find_last("[/\\]") if i then return p:sub(i + 1) @@ -48,6 +56,10 @@ end -- get the basename of the path function path.basename(p) + + -- check + assert(p) + local name = path.filename(p) local i = name:find_last(".", true) if i then @@ -89,6 +101,10 @@ end -- split path by the separator function path.split(p) + + -- check + assert(p) + return p:split("/\\") end @@ -104,13 +120,17 @@ end -- the last character is the path seperator? function path.islastsep(p) + + -- check + assert(p) + local sep = p:sub(#p, #p) return xmake._HOST == "windows" and (sep == '\\' or sep == '/') or (sep == '/') end -- convert path pattern to a lua pattern function path.pattern(pattern) - + -- translate wildcards, .e.g *, ** pattern = pattern:gsub("([%+%.%-%^%$%(%)%%])", "%%%1") pattern = pattern:gsub("%*%*", "\001") |
