@@ -1980,32 +1980,14 @@ fn open_to_and_set_permissions(
19801980 Ok ( ( writer, writer_metadata) )
19811981}
19821982
1983- #[ cfg( not( any ( target_os = "linux" , target_os = "android" , target_vendor = "apple" ) ) ) ]
1983+ #[ cfg( not( target_vendor = "apple" ) ) ]
19841984pub fn copy ( from : & Path , to : & Path ) -> io:: Result < u64 > {
19851985 let ( mut reader, reader_metadata) = open_from ( from) ?;
19861986 let ( mut writer, _) = open_to_and_set_permissions ( to, reader_metadata) ?;
19871987
19881988 io:: copy ( & mut reader, & mut writer)
19891989}
19901990
1991- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1992- pub fn copy ( from : & Path , to : & Path ) -> io:: Result < u64 > {
1993- let ( mut reader, reader_metadata) = open_from ( from) ?;
1994- let max_len = u64:: MAX ;
1995- let ( mut writer, _) = open_to_and_set_permissions ( to, reader_metadata) ?;
1996-
1997- use super :: kernel_copy:: { CopyResult , copy_regular_files} ;
1998-
1999- match copy_regular_files ( reader. as_raw_fd ( ) , writer. as_raw_fd ( ) , max_len) {
2000- CopyResult :: Ended ( bytes) => Ok ( bytes) ,
2001- CopyResult :: Error ( e, _) => Err ( e) ,
2002- CopyResult :: Fallback ( written) => match io:: copy:: generic_copy ( & mut reader, & mut writer) {
2003- Ok ( bytes) => Ok ( bytes + written) ,
2004- Err ( e) => Err ( e) ,
2005- } ,
2006- }
2007- }
2008-
20091991#[ cfg( target_vendor = "apple" ) ]
20101992pub fn copy ( from : & Path , to : & Path ) -> io:: Result < u64 > {
20111993 const COPYFILE_ALL : libc:: copyfile_flags_t = libc:: COPYFILE_METADATA | libc:: COPYFILE_DATA ;
0 commit comments