Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/rustup-dist/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,33 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>,
remove: &[Component])
-> Result<Option<String>> {

let fresh_install = !prefix.path().exists();

let res = update_from_dist_(download,
update_hash,
toolchain,
prefix,
add,
remove);

// Don't leave behind an empty / broken installation directory
if res.is_err() && fresh_install {
// FIXME Ignoring cascading errors
let _ = utils::remove_dir("toolchain", prefix.path(),
&|n| (download.notify_handler)(n.into()));
}

res
}

pub fn update_from_dist_<'a>(download: DownloadCfg<'a>,
update_hash: Option<&Path>,
toolchain: &ToolchainDesc,
prefix: &InstallPrefix,
add: &[Component],
remove: &[Component])
-> Result<Option<String>> {

let toolchain_str = toolchain.to_string();
let manifestation = try!(Manifestation::open(prefix.clone(), toolchain.target.clone()));

Expand Down