diff --git a/Cargo.lock b/Cargo.lock index 2ee5721..cf8f765 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1471,10 +1471,17 @@ dependencies = [ "reqwest", "structopt", "subprocess", + "symlink", "tiny_http", "url", ] +[[package]] +name = "symlink" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" + [[package]] name = "syn" version = "1.0.73" diff --git a/Cargo.toml b/Cargo.toml index b15ac40..056922a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ encoding_rs = "^0.8" lazy_static = "1.4.0" pathdiff = "^0.2" md5 = "^0.7" +symlink = "^0.1.0" [dev-dependencies] tiny_http = "^0.8" diff --git a/src/disk.rs b/src/disk.rs index a022c87..a944839 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -1,6 +1,7 @@ use std::fs; use std::io::Write; use std::path::PathBuf; +use symlink::symlink_auto; use crate::{error, warn}; @@ -37,7 +38,7 @@ pub fn symlink(source: &str, destination: &str, path: &Option) { None => PathBuf::from(destination), }; - if let Err(_) = std::os::unix::fs::symlink(source, &destination) { + if let Err(_) = symlink_auto(source, &destination) { warn!( "{} is already present, coulnd't create a symlink to {}", destination.display(),