diff options
| author | ruki <[email protected]> | 2023-03-09 23:01:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-09 23:01:47 +0800 |
| commit | ee043df59baa9c496e12e930790e86d1bae22d16 (patch) | |
| tree | 2216ad9146b93c91f21f9739837c388b0f4f7389 /xmake/core/base/path.lua | |
| parent | a998fe06c24a2e041e6cf44a26437072e9b0c132 (diff) | |
improve path and moc rule #3457
Diffstat (limited to 'xmake/core/base/path.lua')
| -rw-r--r-- | xmake/core/base/path.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua index bd0701702..59c891a3c 100644 --- a/xmake/core/base/path.lua +++ b/xmake/core/base/path.lua @@ -65,6 +65,11 @@ function _instance:set(p) return self end +function _instance:empty() + local str = self._STR + return str == nil or #str == 0 +end + function _instance:transform_set(transform) self._TRANSFORM = transform self:_update() @@ -138,12 +143,12 @@ end -- tostring(path) function _instance:__tostring() - return self:str() + return not self:empty() and self:str() or "" end -- todisplay(path) function _instance:__todisplay() - return "<path: " .. self:str() .. ">" + return "<path: " .. (self:empty() and "empty" or self:str()) .. ">" end -- path.translate: |
