diff --git a/Cargo.toml b/Cargo.toml index b6a2472..2dad510 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cpkg" description = "A dead simple C package manager." -version = "0.8.2" +version = "0.8.3" edition = "2021" authors = ["David Cruz "] diff --git a/src/main.rs b/src/main.rs index 6b72208..5797171 100644 --- a/src/main.rs +++ b/src/main.rs @@ -571,20 +571,23 @@ fn main() -> anyhow::Result<()> { let now = std::time::Instant::now(); for (name, dep) in &config.dependencies { + let dep_path = build.join(name); + + if dep_path.exists() { + continue; + } + match dep { ConfigDependency::Git { git } => { - let path = build.join(name); - - if !path.exists() { - std::process::Command::new(&git_cmd) - .arg("clone") - .arg(git) - .arg(path) - .spawn()?; - } + std::process::Command::new(&git_cmd) + .arg("clone") + .arg(git) + .arg(dep_path) + .spawn()?; }, - _ => { - anyhow::bail!("Unsupported dependency type"); + + ConfigDependency::Path { path } => { + std::fs::hard_link(path, dep_path)?; } } }