summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordoug tangren <d.tangren@gmail.com>2018-07-06 01:04:37 -0400
committerGitHub <noreply@github.com>2018-07-06 01:04:37 -0400
commitd9f74e3253d3f1657913389d28bd3bbe7c74ccdc (patch)
treeb00667262edb4b2628d6ccf2e560c872218591f7 /src
parentc4d95a71b646b5d1e09f698827a86b9840e41996 (diff)
parent823b22522e99677a560db0cb11ed2fb0d55960d6 (diff)
Merge pull request #82 from klieth/tar-version
Update tar dependency to 0.4
Diffstat (limited to 'src')
-rw-r--r--src/tarball.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tarball.rs b/src/tarball.rs
index 50dd97d..7a9d653 100644
--- a/src/tarball.rs
+++ b/src/tarball.rs
@@ -3,17 +3,17 @@ use flate2::write::GzEncoder;
use std::fs::{self, File};
use std::io::{self, Write};
use std::path::{MAIN_SEPARATOR, Path};
-use tar::Archive;
+use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
pub fn dir<W>(buf: W, path: &str) -> io::Result<()>
where
W: Write,
{
- let archive = Archive::new(GzEncoder::new(buf, Compression::Best));
- fn bundle<F>(dir: &Path, f: &F, bundle_dir: bool) -> io::Result<()>
+ let mut archive = Builder::new(GzEncoder::new(buf, Compression::Best));
+ fn bundle<F>(dir: &Path, f: &mut F, bundle_dir: bool) -> io::Result<()>
where
- F: Fn(&Path) -> io::Result<()>,
+ F: FnMut(&Path) -> io::Result<()>,
{
if fs::metadata(dir)?.is_dir() {
if bundle_dir {
@@ -41,7 +41,7 @@ where
}
}
- let append = |path: &Path| {
+ let mut append = |path: &Path| {
let canonical = path.canonicalize()?;
// todo: don't unwrap
let relativized = canonical.to_str().unwrap().trim_left_matches(
@@ -57,9 +57,9 @@ where
}
Ok(())
};
- bundle(Path::new(path), &append, false)?;
- archive.finish()?;
+ bundle(Path::new(path), &mut append, false)?;
}
+ archive.finish()?;
Ok(())
}