From 62a99f8dc3c3e6e422de54b00a61a34d8b33b403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?= Date: Sat, 7 Jul 2018 15:48:22 +0200 Subject: [PATCH] use just last part of pathname in the tar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously: ``` $ curl -s http://localhost:8000/target/release/build.tar -o - | tar tf - target/release/build/rayon-core-b8ae11d289218da3 … ``` Now: ``` $ curl -s http://localhost:8000/target/release/build.tar -o - | tar tf - build/rayon-core-b8ae11d289218da3 … ``` --- src/channel.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/channel.rs b/src/channel.rs index 5caaecd..24bcb64 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -11,8 +11,9 @@ pub fn run_tar_in_thread(path: PathBuf) -> futures::sync::mpsc::UnboundedReceive thread::spawn(move || { let mut a = tar::Builder::new(writer); + let last_path_component = path.file_name().unwrap(); a.mode(tar::HeaderMode::Deterministic); - a.append_dir_all(path.clone(), path); + a.append_dir_all(last_path_component, &path); a.finish(); }); stream