Skip to content

Commit

Permalink
using symlink instead of copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tsucchi committed Jan 13, 2011
1 parent 0dce772 commit ec39300
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions install.pl
Expand Up @@ -14,15 +14,16 @@

my $my_program = basename($0);
opendir(my $dir, '.');
my @dotfiles = grep { $_ ~= /\A\./xms }
my @dotfiles = grep { $_ =~ /\A\./xms }
grep { $_ !~ /\A\.\.?\z/xms }
grep { $_ !~ /\A.gitignore\z/xms } readdir($dir);
closedir($dir);


for my $dotfile ( @dotfiles ) {
my $newfile = File::Spec->catfile($home, $dotfile);
my $dotfile_full = File::Spec->catfile($work_dir, $dotfile);
next if ( -d $dotfile );
unlink $newfile if ( -e $newfile );
copy $dotfile, $newfile or die $!;
unlink $newfile if ( -l $newfile || -e $newfile );
symlink $dotfile_full, $newfile or die $!;
}

0 comments on commit ec39300

Please sign in to comment.