diff options
| -rw-r--r-- | xmake/core/base/path.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua index 568ba5a25..02e010d89 100644 --- a/xmake/core/base/path.lua +++ b/xmake/core/base/path.lua @@ -30,6 +30,7 @@ local _instance = _instance or {} path._absolute = path._absolute or path.absolute path._relative = path._relative or path.relative path._translate = path._translate or path.translate +path._directory = path._directory or path.directory -- new a path function _instance.new(p, transform) @@ -192,10 +193,13 @@ function path.normalize(p) return path.translate(tostring(p), {normalize = true}) end --- get the directory of the path, compatible with lower version core binary -if not path.directory then - function path.directory(p, sep) - p = tostring(p) +-- get the directory of the path +function path.directory(p, sep) + p = tostring(p) + if path._directory then + return path._directory(p, sep) + else + -- compatible with lower version core binary local i = 0 if sep then -- if the path has been normalized, we can quickly find it with a unique path separator prompt |
