@@ -708,10 +708,7 @@ function Path:parents()
708
708
end
709
709
710
710
function Path :is_file ()
711
- local stat = uv .fs_stat (self :expand ())
712
- if stat then
713
- return stat .type == " file" and true or nil
714
- end
711
+ return self :_stat ().type == " file" and true or nil
715
712
end
716
713
717
714
-- TODO:
@@ -725,7 +722,7 @@ function Path:write(txt, flag, mode)
725
722
726
723
mode = mode or 438
727
724
728
- local fd = assert (uv .fs_open (self :expand (), flag , mode ))
725
+ local fd = assert (uv .fs_open (self :_fs_filename (), flag , mode ))
729
726
assert (uv .fs_write (fd , txt , - 1 ))
730
727
assert (uv .fs_close (fd ))
731
728
end
735
732
function Path :_read ()
736
733
self = check_self (self )
737
734
738
- local fd = assert (uv .fs_open (self :expand (), " r" , 438 )) -- for some reason test won't pass with absolute
735
+ local fd = assert (uv .fs_open (self :_fs_filename (), " r" , 438 )) -- for some reason test won't pass with absolute
739
736
local stat = assert (uv .fs_fstat (fd ))
740
737
local data = assert (uv .fs_read (fd , stat .size , 0 ))
741
738
assert (uv .fs_close (fd ))
@@ -777,7 +774,7 @@ function Path:head(lines)
777
774
self = check_self (self )
778
775
local chunk_size = 256
779
776
780
- local fd = uv .fs_open (self :expand (), " r" , 438 )
777
+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
781
778
if not fd then
782
779
return
783
780
end
@@ -820,7 +817,7 @@ function Path:tail(lines)
820
817
self = check_self (self )
821
818
local chunk_size = 256
822
819
823
- local fd = uv .fs_open (self :expand (), " r" , 438 )
820
+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
824
821
if not fd then
825
822
return
826
823
end
884
881
function Path :readbyterange (offset , length )
885
882
self = check_self (self )
886
883
887
- local fd = uv .fs_open (self :expand (), " r" , 438 )
884
+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
888
885
if not fd then
889
886
return
890
887
end
0 commit comments