Skip to content

Commit 8c903b7

Browse files
committed
fix up unix stuff a bit
1 parent 32ddebb commit 8c903b7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/plenary/path2.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ end
110110
---@return string root
111111
---@return string relpath
112112
function _PosixPath:split_root(part)
113-
if part:sub(1) == self.sep then
114-
part = (part:gsub("^" .. self.sep, ""))
115-
return "", self.sep, part:sub(2, #part)
113+
if part:sub(1, 1) == self.sep then
114+
return "", self.sep, part:sub(2)
116115
end
117116
return "", "", part
118117
end
@@ -386,7 +385,7 @@ function Path:is_absolute()
386385
return false
387386
end
388387

389-
return self._flavor.has_drv and self.drv ~= ""
388+
return not self._flavor.has_drv or self.drv ~= ""
390389
end
391390

392391
---@return boolean
@@ -509,8 +508,9 @@ function Path:make_relative(to)
509508
end
510509

511510
-- vim.o.shellslash = false
512-
local p = Path:new { "C:", "lua", "..", "README.md" }
513-
print(p.filename)
511+
local p = Path:new { "/mnt/c/Users/jtrew/neovim/plenary.nvim/README.md" }
512+
vim.print(p.drv, p.root, p.relparts)
513+
print(p.filename, p:is_absolute())
514514
-- vim.o.shellslash = true
515515

516516
return Path

0 commit comments

Comments
 (0)