Skip to content

Commit

Permalink
fix(base): return self from to_absolute for easier chaining (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 authored Mar 21, 2024
1 parent 6e7219f commit b8d3184
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/pathlib/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,12 @@ end
---@param cwd PathlibPath|nil # If passed, this is used instead of `vim.fn.getcwd()`.
function Path:to_absolute(cwd)
if self:is_absolute() then
return
return self
end
local new = self.new(cwd or vim.fn.getcwd(), self)
self._raw_paths:clear()
self:copy_all_from(new)
return self
end

---Get the path being modified with `filename-modifiers`
Expand Down

0 comments on commit b8d3184

Please sign in to comment.