From a567cffa4167b92f8636ee2ba1a57ceaf3324e4e Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 9 Jul 2021 10:51:13 -0400 Subject: Allow parsing depot files with link errors. If there is an error while creating the links after reading from file then a warning is printed and that link is ignored. --- dotup_cli/src/utils.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'dotup_cli/src') diff --git a/dotup_cli/src/utils.rs b/dotup_cli/src/utils.rs index 706266e..1ac8c95 100644 --- a/dotup_cli/src/utils.rs +++ b/dotup_cli/src/utils.rs @@ -78,9 +78,17 @@ pub fn read_depot(archive_path: impl AsRef) -> anyhow::Result { let archive = read_archive(&archive_path)?; let depot_config = DepotConfig { archive_path, - archive, + archive: Default::default(), }; - let depot = Depot::new(depot_config)?; + let mut depot = Depot::new(depot_config)?; + + for archive_link in archive.links { + let link_params = LinkCreateParams::from(archive_link); + if let Err(e) = depot.create_link(link_params) { + log::warn!("Error while adding link : {}", e); + } + } + Ok(depot) } -- cgit