@@ -708,10 +708,7 @@ function Path:parents()
708708end
709709
710710function 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
715712end
716713
717714-- TODO:
@@ -725,7 +722,7 @@ function Path:write(txt, flag, mode)
725722
726723 mode = mode or 438
727724
728- local fd = assert (uv .fs_open (self :expand (), flag , mode ))
725+ local fd = assert (uv .fs_open (self :_fs_filename (), flag , mode ))
729726 assert (uv .fs_write (fd , txt , - 1 ))
730727 assert (uv .fs_close (fd ))
731728end
735732function Path :_read ()
736733 self = check_self (self )
737734
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
739736 local stat = assert (uv .fs_fstat (fd ))
740737 local data = assert (uv .fs_read (fd , stat .size , 0 ))
741738 assert (uv .fs_close (fd ))
@@ -777,7 +774,7 @@ function Path:head(lines)
777774 self = check_self (self )
778775 local chunk_size = 256
779776
780- local fd = uv .fs_open (self :expand (), " r" , 438 )
777+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
781778 if not fd then
782779 return
783780 end
@@ -820,7 +817,7 @@ function Path:tail(lines)
820817 self = check_self (self )
821818 local chunk_size = 256
822819
823- local fd = uv .fs_open (self :expand (), " r" , 438 )
820+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
824821 if not fd then
825822 return
826823 end
884881function Path :readbyterange (offset , length )
885882 self = check_self (self )
886883
887- local fd = uv .fs_open (self :expand (), " r" , 438 )
884+ local fd = uv .fs_open (self :_fs_filename (), " r" , 438 )
888885 if not fd then
889886 return
890887 end
0 commit comments