src/pxar/sequential_decoder.rs: create all directories in target path

Create the full target path and not fail if an intermediate directory does not
exist.
This is needed in order to restore multiple archives via the catalog, where the
target should further contain each archive name as subdir.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-11-14 17:42:16 +01:00 committed by Dietmar Maurer
parent b6ca690095
commit d3bcc7f261

View File

@ -724,7 +724,8 @@ impl<R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<R, F> {
///
/// The directory is created if it does not exist.
pub fn restore(&mut self, path: &Path, match_pattern: &[MatchPattern]) -> Result<(), Error> {
let _ = std::fs::create_dir(path);
std::fs::create_dir_all(path)
.map_err(|err| format_err!("error while creating directory {:?} - {}", path, err))?;
let dir = nix::dir::Dir::open(
path,