refactor(link): propagate canonicalization errors
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
fe7c932c69
commit
f17e2a5986
1 changed files with 1 additions and 4 deletions
|
@ -172,10 +172,7 @@ impl From<std::io::Error> for LinkError {
|
||||||
|
|
||||||
fn handle_file_exists(selff: &Link, tx_path: &Path, rx_path: &Path) -> Result<bool, LinkError> {
|
fn handle_file_exists(selff: &Link, tx_path: &Path, rx_path: &Path) -> Result<bool, LinkError> {
|
||||||
match rx_path.read_link() {
|
match rx_path.read_link() {
|
||||||
Ok(file)
|
Ok(file) if file.canonicalize()? == tx_path.canonicalize()? => {
|
||||||
if file.canonicalize().expect("failed to canonicalize file")
|
|
||||||
== tx_path.canonicalize().expect("failed to canonicalize path") =>
|
|
||||||
{
|
|
||||||
Err(LinkError::AlreadyLinked(
|
Err(LinkError::AlreadyLinked(
|
||||||
tx_path.to_string_lossy().to_string(),
|
tx_path.to_string_lossy().to_string(),
|
||||||
rx_path.to_string_lossy().to_string(),
|
rx_path.to_string_lossy().to_string(),
|
||||||
|
|
Loading…
Reference in a new issue