summaryrefslogtreecommitdiff
path: root/util/mklink.pl
diff options
context:
space:
mode:
Diffstat (limited to 'util/mklink.pl')
-rwxr-xr-xutil/mklink.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/util/mklink.pl b/util/mklink.pl
index 61db12c68f31..a937606ea5c2 100755
--- a/util/mklink.pl
+++ b/util/mklink.pl
@@ -55,9 +55,11 @@ if ($^O eq "msys") { $symlink_exists=0 };
foreach $file (@files) {
my $err = "";
if ($symlink_exists) {
- unlink "$from/$file";
- symlink("$to/$file", "$from/$file") or $err = " [$!]";
- } else {
+ if (!-l "$from/$file") {
+ unlink "$from/$file";
+ symlink("$to/$file", "$from/$file") or $err = " [$!]";
+ }
+ } elsif (-d "$from" && (!-f "$from/$file" || ((stat("$file"))[9] > (stat("$from/$file"))[9]))) {
unlink "$from/$file";
open (OLD, "<$file") or die "Can't open $file: $!";
open (NEW, ">$from/$file") or die "Can't open $from/$file: $!";