diff options
| author | ruki <[email protected]> | 2025-08-13 22:55:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-13 22:55:26 +0800 |
| commit | 7ab1594d2578a0b31d0d09ed2ac813a8be0ee680 (patch) | |
| tree | e9554724a36aac9d7b9a1ecc53fb8c0cbf9e4a8a | |
| parent | f6011a38e6e48e213ac9ed8ad64e92677b5702f1 (diff) | |
fix path.directory #6700
| -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 |
