Commit eabea024 authored by Bodo Möller's avatar Bodo Möller
Browse files

Don't make assumptions on what the path looks like.

parent 8eb57af5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -15,19 +15,19 @@ foreach $arg (@ARGV) {
sub do_mkdir_p {
  local($dir) = @_;

  $dir =~ s|/*$||;
  $dir =~ s|/*\Z(?!\n)||s;

  if (-d $dir) {
    return;
  }

  if ($dir =~ /\//) {
  if ($dir =~ m|[^/]/|s) {
    local($parent) = $dir;
    $parent =~ s|[^/]*$||;
    $parent =~ s|[^/]*\Z(?!\n)||s;

    do_mkdir_p($parent);
  }

  mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
  print "created directory $dir\n";
  print "created directory `$dir'\n";
}