From a18b188f5b0129aebd96989f9c2338b51537e1e1 Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Thu, 18 Mar 2021 10:07:35 +0100
Subject: [PATCH] - fix: dir creation failed on paths with multiple directories

---
 bin/slubsipbuilderbagit.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index 0cd0612..05238e0 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -435,7 +435,11 @@ PATCH
         my $path = $_[0];
 
         if(! -d $path && ! -f $path){
-            mkdir($path) or die "Could not mkdir $path: $!";
+            eval { path($path)->mkpath; };
+            if ($@) { # error
+                print_scalar_data("", "ERROR: Failed to create directory '$path'.", "", "red");
+                die $@;
+            }
         }
         return 1;
     }
-- 
GitLab