File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,33 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>,
497497 remove : & [ Component ] )
498498 -> Result < Option < String > > {
499499
500+ let fresh_install = !prefix. path ( ) . exists ( ) ;
501+
502+ let res = update_from_dist_ ( download,
503+ update_hash,
504+ toolchain,
505+ prefix,
506+ add,
507+ remove) ;
508+
509+ // Don't leave behind an empty / broken installation directory
510+ if res. is_err ( ) && fresh_install {
511+ // FIXME Ignoring cascading errors
512+ let _ = utils:: remove_dir ( "toolchain" , prefix. path ( ) ,
513+ & |n| ( download. notify_handler ) ( n. into ( ) ) ) ;
514+ }
515+
516+ res
517+ }
518+
519+ pub fn update_from_dist_ < ' a > ( download : DownloadCfg < ' a > ,
520+ update_hash : Option < & Path > ,
521+ toolchain : & ToolchainDesc ,
522+ prefix : & InstallPrefix ,
523+ add : & [ Component ] ,
524+ remove : & [ Component ] )
525+ -> Result < Option < String > > {
526+
500527 let toolchain_str = toolchain. to_string ( ) ;
501528 let manifestation = try!( Manifestation :: open ( prefix. clone ( ) , toolchain. target . clone ( ) ) ) ;
502529
You can’t perform that action at this time.
0 commit comments