diff --git a/Cargo.lock b/Cargo.lock index 0654509..baf73f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ [[package]] name = "anode-cache-common" version = "0.1.0" -source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v3#a460ddb58f8b2006a9edfd231d12882cc95bcca0" +source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v2#0a3a59229111c6a96a2565de8a3e097c7bc2808b" dependencies = [ "anyhow", "isahc", diff --git a/Cargo.toml b/Cargo.toml index 521380c..d295da4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ tag = "v1" [dependencies.anode-cache-common] git = "https://git.dzuchun.ing/actions/cache-common-src.git" -tag = "v3" +tag = "v2" [build-dependencies.anode-build] git = "https://git.dzuchun.ing/dzu/anode.git" diff --git a/src/main.rs b/src/main.rs index 17f0016..d6c7f06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,11 +49,8 @@ fn main() -> Result<()> { let mut archive = Builder::new(out_comp); archive.mode(HeaderMode::Complete); archive.follow_symlinks(false); - - let common = anode_cache_common::common_parent(&path); - debug!(common_path = %common.display(), paths = ?path); - - for (path, name) in path.iter().map(|p| (p, p.strip_prefix(&common).unwrap())) { + debug!(paths = ?path); + for path in path { let _span = info_span!("cache-entry"); let _span = _span.enter(); if !path.exists() { @@ -63,11 +60,11 @@ fn main() -> Result<()> { if path.is_dir() { debug!("Caching directory"); // we actually want to write out all the directory contents - archive.append_dir_all(name, path).unwrap(); + archive.append_dir_all(&path, &path).unwrap(); } else if path.is_file() { debug!("Caching a file"); // rest of the file types are handled by the existing inner code - archive.append_path_with_name(path, name).unwrap(); + archive.append_path(path).unwrap(); } else { warn!("Path is neither directory, nor a file and will not be cached"); }