diff --git a/components/utils/Cargo.toml b/components/utils/Cargo.toml index ee10a0fd91..65c4513381 100644 --- a/components/utils/Cargo.toml +++ b/components/utils/Cargo.toml @@ -8,7 +8,6 @@ include = ["src/**/*"] [dependencies] serde = { version = "1.0", features = ["derive"] } -console = { path = "../console" } errors = { path = "../errors" } libs = { path = "../libs" } diff --git a/components/utils/src/fs.rs b/components/utils/src/fs.rs index 1edc113670..01478983f2 100644 --- a/components/utils/src/fs.rs +++ b/components/utils/src/fs.rs @@ -87,15 +87,9 @@ pub fn copy_file_if_needed(src: &Path, dest: &Path, hard_link: bool) -> Result<( if hard_link { if dest.exists() { - if let Err(e) = std::fs::remove_file(dest) { - console::error(&format!("File System Error, src: {:?}, dst: {:?}", src, dest)); - return Err(e.into()); - } - } - if let Err(e) = std::fs::hard_link(src, dest) { - console::error(&format!("File System Error, src: {:?}, dst: {:?}", src, dest)); - return Err(e.into()); + std::fs::remove_file(dest).with_context(|| "Error removing file, dst: {:?}", dest)?; } + std::fs::hard_link(src, dest).with_context(|| "Error linking file, src: {:?}, dst: {:?}", src, dest)?; } else { let src_metadata = metadata(src) .with_context(|| format!("Failed to get metadata of {}", src.display()))?;