summaryrefslogtreecommitdiffstats
path: root/MDK/Common/File.pm
diff options
context:
space:
mode:
Diffstat (limited to 'MDK/Common/File.pm')
-rw-r--r--MDK/Common/File.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/MDK/Common/File.pm b/MDK/Common/File.pm
index 49895a0..95b2b30 100644
--- a/MDK/Common/File.pm
+++ b/MDK/Common/File.pm
@@ -219,6 +219,14 @@ sub glob_ {
sub substInFile(&@) {
my ($f, $file) = @_;
+ my $linkdest;
+ #- try hard to keep symlinks as they were set
+ if (-l $file) {
+ my $targetfile = readlink $file;
+ unlink $file;
+ $linkdest = $file;
+ $file = $targetfile;
+ }
if (-s $file) {
local @ARGV = $file;
local $^I = '';
@@ -235,6 +243,7 @@ sub substInFile(&@) {
select $old;
eval { output($file, $_) };
}
+ $linkdest and symlink $file, $linkdest;
}