Skip to content

Commit

Permalink
Add some context to Result unwrapping (#46)
Browse files Browse the repository at this point in the history
Co-authored-by: Tao Lu <[email protected]>
  • Loading branch information
yeetfield and Tao Lu authored Feb 1, 2023
1 parent e38b9aa commit 7ce1e92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rozy/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ pub fn softlink(from_command: &str, to_command: &str) -> Result<bool> {
// TODO: unlink from_command_path? Also is this equivalent to what's happening in Python where we unlink path_to_app?
}

std::os::unix::fs::symlink(to_command_path, from_command_path)?;
std::os::unix::fs::symlink(&to_command_path, &from_command_path).with_context(|| {
format!(
"While symlinking {} to {}",
&from_command_path.display(),
&to_command_path.display()
)
})?;
Ok(was_there)
}

0 comments on commit 7ce1e92

Please sign in to comment.