install.pl: made directory creation work properly

This commit is contained in:
Adrian Kreher 2008-12-18 18:54:24 -06:00
parent b4dc577c24
commit c1a540bb45

View file

@ -17,7 +17,7 @@ my $home = bsd_glob('~', GLOB_TILDE);
if(grep /^(?:-h|--help|-\?)$/, @ARGV) { if(grep /^(?:-h|--help|-\?)$/, @ARGV) {
print <<EOH; print <<EOH;
install.pl: installs symbollic links from dotfile repo into your home directory install.pl: installs symbolic links from dotfile repo into your home directory
Options: Options:
-f force an overwrite existing files -f force an overwrite existing files
@ -33,7 +33,7 @@ my $force = 0;
$force = 1 if grep /^(?:-f|--force)$/, @ARGV; $force = 1 if grep /^(?:-f|--force)$/, @ARGV;
unless(eval {symlink('', ''); 1;}) { unless(eval {symlink('', ''); 1;}) {
die "Your symbollic links are not very link-like.\n"; die "Your symbolic links are not very link-like.\n";
} }
my %links = ( my %links = (
@ -58,7 +58,7 @@ my %links = (
for my $file (keys %links) { for my $file (keys %links) {
my($path) = $links{$file} =~ m{^ (.+/)? [^/]+ $}x; my($path) = $links{$file} =~ m{^ (.+/)? [^/]+ $}x;
mkpath($path) if $path; mkpath("$home/$path") if $path;
my $src = "$scriptdir/$file"; my $src = "$scriptdir/$file";
my $dest = "$home/$links{$file}"; my $dest = "$home/$links{$file}";