Improve error handling.

This commit is contained in:
r-vdp 2023-04-27 01:57:04 +02:00
parent 36250cf6fa
commit 2f8a9ba967
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View file

@ -209,7 +209,11 @@ where
) -> EtcActivationResult {
let link_path = etc_dir.join(link_target);
// Create the dir if it doesn't exist yet
let dir_state = create_dir_recursively(&link_path, state)?;
let dir_state = if !link_path.exists() {
create_dir_recursively(&link_path, state)?
} else {
state
};
log::debug!("Entering into directory {}...", link_path.display());
Ok(absolute_target
.read_dir()