mirror of
https://github.com/NaomiAmethyst/dots.git
synced 2025-09-18 21:39:54 +00:00
Merge branch 'master' of ssh://majnematic.com/davesdots
This commit is contained in:
commit
26b7289812
1 changed files with 16 additions and 0 deletions
16
install.pl
16
install.pl
|
@ -84,6 +84,13 @@ my %links = (
|
|||
gdbinit => '.gdbinit',
|
||||
);
|
||||
|
||||
my $contained = (substr $scriptdir, 0, length($home)) eq $home;
|
||||
my $prefix = undef;
|
||||
if ($contained) {
|
||||
$prefix = substr $scriptdir, length($home);
|
||||
($prefix) = $prefix =~ m{^\/? (.+) [^/]+ $}x;
|
||||
}
|
||||
|
||||
my $i = 0; # Keep track of how many links we added
|
||||
for my $file (keys %links) {
|
||||
# See if this file resides in a directory, and create it if needed.
|
||||
|
@ -106,6 +113,15 @@ for my $file (keys %links) {
|
|||
unlink($dest) || warn "Couldn't unlink '$dest': $!\n";
|
||||
}
|
||||
|
||||
if ($contained) {
|
||||
chdir $home;
|
||||
$dest = "$links{$file}";
|
||||
$src = "$prefix$file";
|
||||
if ($path) {
|
||||
$src = "../$src";
|
||||
}
|
||||
}
|
||||
|
||||
symlink($src => $dest) ? $i++ : warn "Couldn't link '$src' to '$dest': $!\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue