Skip to content

Commit 470d0e8

Browse files
authored
fix: readbytesrange on windows (#345)
1 parent f9c65cd commit 470d0e8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/plenary/path.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,11 @@ function Path:readbyterange(offset, length)
859859

860860
if offset < 0 then
861861
offset = stat.size + offset
862+
-- Windows fails if offset is < 0 even though offset is defined as signed
863+
-- http://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_read
864+
if offset < 0 then
865+
offset = 0
866+
end
862867
end
863868

864869
local data = ""

0 commit comments

Comments
 (0)