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

This commit is contained in:
Bodo Möller 1999-06-08 10:17:55 +00:00
parent 8eb57af5fe
commit eabea024e8

View File

@ -15,19 +15,19 @@ foreach $arg (@ARGV) {
sub do_mkdir_p { sub do_mkdir_p {
local($dir) = @_; local($dir) = @_;
$dir =~ s|/*$||; $dir =~ s|/*\Z(?!\n)||s;
if (-d $dir) { if (-d $dir) {
return; return;
} }
if ($dir =~ /\//) { if ($dir =~ m|[^/]/|s) {
local($parent) = $dir; local($parent) = $dir;
$parent =~ s|[^/]*$||; $parent =~ s|[^/]*\Z(?!\n)||s;
do_mkdir_p($parent); do_mkdir_p($parent);
} }
mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n"; mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
print "created directory $dir\n"; print "created directory `$dir'\n";
} }