diff options
-rwxr-xr-x | bin/checklinks | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/checklinks b/bin/checklinks index ef96386..a2e21af 100755 --- a/bin/checklinks +++ b/bin/checklinks @@ -56,6 +56,7 @@ sub check_symlink { my $src = shift; my $dst = shift; + mkdirs($src); #if (not -e "$base/$dst") { # print_format('no dst!!', $src, $dst, 'red bold'); #} @@ -83,6 +84,7 @@ sub check_hardlink { my $src = shift; my $dst = shift; + mkdirs($src); if (not -e "$base/$dst") { print_format('no dst!!', $src, $dst, 'red bold'); } @@ -100,6 +102,18 @@ sub check_hardlink { } } +sub mkdirs { + my $source = shift; + my $path = $base; + $source =~ s/\/[^\/]+$//; + foreach(split(/\//, $source)) { + unless(-d "$path/$_") { + mkdir("$path/$_") or die("Can't create $path/$_: $!"); + } + $path .= $_; + } +} + sub print_format { my ($message, $src, $dst, $color) = @_; |