Browse Source

Resolve link source to absolute path to minimize bad links

Alois Mahdal 12 years ago
parent
commit
4dcfc35915
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      mklinks

+ 2
- 1
mklinks View File

30
 use strict;
30
 use strict;
31
 use warnings;
31
 use warnings;
32
 use Getopt::Long;
32
 use Getopt::Long;
33
+use File::Spec;
33
 
34
 
34
 sub usage { print STDERR "usage: $0: DOTROOT [PREFIX]\n"; exit 1; }
35
 sub usage { print STDERR "usage: $0: DOTROOT [PREFIX]\n"; exit 1; }
35
 
36
 
53
     my @dirs = `ls $dotroot`;
54
     my @dirs = `ls $dotroot`;
54
     foreach my $dir (@dirs) {
55
     foreach my $dir (@dirs) {
55
         chomp $dir;
56
         chomp $dir;
56
-        my $source = "$dotroot/$dir";
57
+        my $source = File::Spec->rel2abs("$dotroot/$dir");
57
         my $target = "$prefix/.$dir";
58
         my $target = "$prefix/.$dir";
58
         `mkdir -p $prefix`;
59
         `mkdir -p $prefix`;
59
         if (-e $target) {
60
         if (-e $target) {