diff options
Diffstat (limited to 'xmake/core/base/path.lua')
| -rw-r--r-- | xmake/core/base/path.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua index ede2c36eb..49850c42b 100644 --- a/xmake/core/base/path.lua +++ b/xmake/core/base/path.lua @@ -24,6 +24,20 @@ local path = path or {} -- load modules local string = require("base/string") +-- path.translate: +-- - transform the path separator +-- - expand the user directory with the prefix: ~ +-- - remove tail separator +-- - reduce the repeat path separator, "////" => "/" +-- +-- path.normalize: +-- - reduce "././" => "." +-- - reduce "/xxx/.." => "/" +-- +function path.normalize(p) + return path.translate(p, {normalize = true}) +end + -- get the filename of the path function path.filename(p, sep) local i = 0 |
