restore snapshots

This commit is contained in:
mpostma 2021-03-22 10:17:38 +01:00
parent 7f6a54cb12
commit 4847884165
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
5 changed files with 143 additions and 33 deletions

View file

@ -17,11 +17,11 @@ pub fn to_tar_gz(src: &Path, dest: &Path) -> Result<(), Error> {
Ok(())
}
pub fn from_tar_gz(src: &Path, dest: &Path) -> Result<(), Error> {
let f = File::open(src)?;
pub fn from_tar_gz(src: impl AsRef<Path>, dest: impl AsRef<Path>) -> Result<(), Error> {
let f = File::open(&src)?;
let gz = GzDecoder::new(f);
let mut ar = Archive::new(gz);
create_dir_all(dest)?;
ar.unpack(dest)?;
create_dir_all(&dest)?;
ar.unpack(&dest)?;
Ok(())
}