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 {
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";
}