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 authored and Dietmar Maurer committed 2019-11-22 07:11:49 +01:00
1 parent b6ca690095
commit d3bcc7f261
1 file changed
+2 -1
+2 -1
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. /// The directory is created if it does not exist.
pub fn restore(&mut self, path: &Path, match_pattern: &[MatchPattern]) -> Result<(), Error> { 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( let dir = nix::dir::Dir::open(
path, path,