From d3bcc7f2619975b43dded0022a46a79f27414bc1 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 14 Nov 2019 17:42:16 +0100 Subject: [PATCH] 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 --- src/pxar/sequential_decoder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index 79c0adce..e3826188 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -724,7 +724,8 @@ impl Result<(), Error>> SequentialDecoder { /// /// 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,