Skip to content

Commit

Permalink
fix(install): add to config before downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
beeb committed Aug 4, 2024
1 parent c88fead commit 9b3ac7c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ async fn install_dependency(
) -> Result<(), SoldeerError> {
lock_check(&dependency, true)?;

let config_file = match get_config_path() {
Ok(file) => file,
Err(e) => {
cleanup_dependency(&dependency, true)?;
return Err(e.into());
}
};
add_to_config(&dependency, &config_file)?;

let result = download_dependency(&dependency, false)
.await
.map_err(|e| SoldeerError::DownloadError { dep: dependency.to_string(), source: e })?;
Expand All @@ -218,21 +227,11 @@ async fn install_dependency(
}
}

let config_file = match get_config_path() {
Ok(file) => file,
Err(e) => {
cleanup_dependency(&dependency, true)?;
return Err(e.into());
}
};

let mut config = read_soldeer_config(Some(config_file.clone()))?;
if regenerate_remappings {
config.remappings_regenerate = regenerate_remappings;
}

add_to_config(&dependency, &config_file)?;

janitor::healthcheck_dependency(&dependency)?;

janitor::cleanup_dependency(&dependency, false)?;
Expand Down

0 comments on commit 9b3ac7c

Please sign in to comment.