diff options
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 21fce2c430c..e4ac72ff563 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -490,19 +490,20 @@ The optional parameter sets the permission flags. =cut sub mkdirhier { - my $tree=shift; - my $mode=shift; - my $subdir; + my ($tree,$mode) = @_; return if (-d "$tree"); - @dirs=split /\//, $tree; - foreach $dir (@dirs) { - $subdir .= ("$dir" . "/"); - unless (-d $subdir) { + my $subdir = ""; + + @dirs = split (/\//, $tree); + for my $dir (@dirs) { + $subdir .= "$dir/"; + if (! -d $subdir) { if (defined $mode) { - mkdir ($subdir, $mode) || die "mkdir($subdir) failed, goodbye: $!"; + mkdir ($subdir, $mode) + || die "$0: mkdir($subdir,$mode) failed, goodbye: $!\n"; } else { - mkdir ($subdir) || die "mkdir($subdir) failed, goodbye: $!"; + mkdir ($subdir) || die "$0: mkdir($subdir) failed, goodbye: $!\n"; } } } |