Changeset 32846

Show
Ignore:
Timestamp:
04.03.2019 13:44:41 (6 months ago)
Author:
ak19
Message:

On windows, our block hash filelists deal in full 'long' pathnames, like gs3-svn-26Feb/web. but reverse_info structure has full paths in windows short form, like GS3-SV~2/web. So need to do a bit of upgrading and downgrading of filenames to make sure when we compare the names we are comparing the same form. By kjdon

Files:
1 modified

Legend:

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

    r32617 r32846  
    413413      &FileUtils::sanitizePath($importdir); 
    414414    } 
     415 
    415416    if (!&FileUtils::directoryExists($importdir)) 
    416417    { 
     
    11961197 
    11971198    foreach my $prev_file (keys %$prev_all_files) { 
    1198  
     1199        # arcinfo deals in real filenames ie windows short names. but the block hash stuff is all full long versions. 
     1200    $prev_file = &util::upgrade_if_dos_filename($prev_file); 
     1201     
    11991202    if (!&FileUtils::isFilenameAbsolute($prev_file)) { 
    12001203        my $full_prev_file = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},$prev_file); 
     
    12111214    # there any more => mark them for deletion 
    12121215    foreach my $curr_file (keys %{$block_hash->{'all_files'}}) { 
    1213      
     1216       
    12141217    my $full_curr_file = $curr_file; 
    12151218 
     
    12261229        # delete it so that only files that need deleting are left 
    12271230        delete $full_prev_all_files->{$full_curr_file}; 
    1228          
    12291231        # had it before. is it a metadata file? 
    12301232        if ($block_hash->{'metadata_files'}->{$full_curr_file}) { 
    1231          
    12321233        # is it modified?? 
    12331234        if (-M $full_curr_file < $archiveinf_timestamp) { 
     
    13661367 
    13671368      if (!-e $full_curr_file) { 
     1369            $curr_file = &util::upgrade_if_dos_filename($curr_file); 
    13681370          $block_hash->{'deleted_files'}->{$curr_file} = 1; 
    13691371      } 
     
    13981400    # that this file is used in (note in most cases, it's just one OID) 
    13991401 
    1400     my $oids = $archive_info->get_reverseinfo($file); 
    1401     $archive_info->remove_reverseinfo($file); 
     1402    my $downgraded_file = &util::downgrade_if_dos_filename($file); 
     1403    my $oids = $archive_info->get_reverseinfo($downgraded_file); 
     1404    $archive_info->remove_reverseinfo($downgraded_file); 
    14021405     
    14031406    foreach my $oid (@$oids) { 
     
    14061409        # find the source doc (the primary file that becomes this oid) 
    14071410        my $doc_source_file = $doc_rec->{'src-file'}->[0]; 
    1408         $doc_source_file = &util::placeholders_to_abspath($doc_source_file); 
     1411        $doc_source_file = &util::placeholders_to_abspath($doc_source_file, "long"); 
    14091412 
    14101413        if (!&FileUtils::isFilenameAbsolute($doc_source_file)) { 
     
    14141417        if ($doc_source_file ne $file) { 
    14151418        # its an associated or metadata file 
    1416          
    14171419        # mark source doc for reimport as one of its assoc files has changed or deleted 
     1420        #$doc_source_file = &util::upgrade_if_dos_filename($doc_source_file); 
    14181421        $block_hash->{'reindex_files'}->{$doc_source_file} = 1; 
    14191422         
     
    14271430            if (!defined $archive_info->get_reverseinfo($assocfile)) { 
    14281431            # nothing refers to it anymore, mark for reindex. 
     1432                # block hash needs full filenames 
     1433                $assocfile =  &util::upgrade_if_dos_filename($assocfile); 
    14291434            $block_hash->{'reindex_files'}->{$assocfile} = 1; 
    14301435            }