File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ pub fn download_file_with_progress_ureq(
5252 . unwrap ( )
5353 . to_string ( ) ;
5454
55+ let tmp_path = Path :: new ( & tmp_output_path) ;
5556 let output_path = Path :: new ( output_path) ;
5657 let mut req = ureq:: get ( url) ;
5758 let req =
@@ -70,7 +71,7 @@ pub fn download_file_with_progress_ureq(
7071 . set ( "Cache-Control" , "no-cache" ) ;
7172
7273 let mut resp = req. call ( ) ;
73- let mut file = std:: fs:: File :: create ( output_path ) ?;
74+ let mut file = std:: fs:: File :: create ( & tmp_path ) ?;
7475 let mut total_size = 0 ;
7576 let mut downloaded_size = 0 ;
7677 let mut buffer = [ 0u8 ; 1024 * 1024 ] ;
@@ -104,6 +105,7 @@ pub fn download_file_with_progress_ureq(
104105 }
105106 }
106107 progress_callback ( DownloadCallbackInfo { progress : 100.0 } ) ;
108+ std:: fs:: rename ( & tmp_path, output_path) ?;
107109 Ok ( ( ) )
108110}
109111
You can’t perform that action at this time.
0 commit comments