Changeset 32123 for main/trunk


Ignore:
Timestamp:
02/08/18 14:34:56 (3 years ago)
Author:
kjdon
Message:

when hard linking, if the destination file already exists then remove it and continue with the hard link. Don't just walk away as we may be trying to link to a new file (as in the case of a source document changing in import).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/FileUtils.pm

    r32090 r32123  
    627627  ##    print STDERR "**** src = ", unicode::debug_unicode_string($src),"\n";
    628628  # a few sanity checks
    629   if (-e $dest)
    630   {
    631     # destination file already exists
    632     return;
    633   }
    634   elsif (!-e $src)
     629  if (!-e $src)
    635630  {
    636631    print STDERR "FileUtils::hardLink() source file \"" . $src . "\" does not exist\n";
     
    641636    print STDERR "FileUtils::hardLink() source \"" . $src . "\" is a directory\n";
    642637    return 1;
     638  }
     639  elsif (-e $dest)
     640  {
     641      print STDERR "FileUtils::hardlink() dest file ($dest) exists, removing it\n";
     642      &removeFiles($dest);
    643643  }
    644644
Note: See TracChangeset for help on using the changeset viewer.