Skip to content

Commit 293e66f

Browse files
committed
Support adding path dependencies
Just hardlinks the path
1 parent 4fbac37 commit 293e66f

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "cpkg"
33
description = "A dead simple C package manager."
4-
version = "0.8.2"
4+
version = "0.8.3"
55
edition = "2021"
66

77
authors = ["David Cruz <[email protected]>"]

src/main.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -571,20 +571,23 @@ fn main() -> anyhow::Result<()> {
571571
let now = std::time::Instant::now();
572572

573573
for (name, dep) in &config.dependencies {
574+
let dep_path = build.join(name);
575+
576+
if dep_path.exists() {
577+
continue;
578+
}
579+
574580
match dep {
575581
ConfigDependency::Git { git } => {
576-
let path = build.join(name);
577-
578-
if !path.exists() {
579-
std::process::Command::new(&git_cmd)
580-
.arg("clone")
581-
.arg(git)
582-
.arg(path)
583-
.spawn()?;
584-
}
582+
std::process::Command::new(&git_cmd)
583+
.arg("clone")
584+
.arg(git)
585+
.arg(dep_path)
586+
.spawn()?;
585587
},
586-
_ => {
587-
anyhow::bail!("Unsupported dependency type");
588+
589+
ConfigDependency::Path { path } => {
590+
std::fs::hard_link(path, dep_path)?;
588591
}
589592
}
590593
}

0 commit comments

Comments
 (0)