Show
Ignore:
Timestamp:
24.01.2012 16:19:58 (8 years ago)
Author:
ak19
Message:

1. Introduced the util::filepath_to_url_format subroutine which will be used to convert filenames to URL style filenames to match the slashes used in the filename regex-es in extrameta keys used to index into extrameta data structures. 2. Fixed bug on windows where metadata.xml specifies filenames as regex with backslash in front of the file extension's period mark: DirectoryPlugin? needed to unregex the filepath before calling fileparse on it, else the escaping backslash would interfere with perl's fileparse routine (only on windows, since backslash also represents a dirsep here). 3. Updated all those perl plugins where the new util::filepath_to_url_format needs to be called so that they use URL style filenames (thereafter regexed) to index into the extrameta data structures.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/OAIPlugin.pm

    r24951 r24971  
    3838use metadatautil; 
    3939use MetadataRead; 
     40use util; 
    4041 
    4142# methods with identical signatures take precedence in the order given in the ISA list. 
     
    255256    # return all the metadata we have extracted to the caller. 
    256257    # Directory plug will pass it back in at read time, so we don't need to extract it again. 
    257     # extrametadata keys should be regular expressions 
     258     
     259    # Extrametadata keys should be regular expressions 
     260    # Indexing into the extrameta data structures requires the filename's style of slashes to be in URL format 
     261    # Then need to convert the filename to a regex, no longer to protect windows directory chars \, but for 
     262    # protecting special characters like brackets in the filepath such as "C:\Program Files (x86)\Greenstone". 
     263    $filename_for_metadata = &util::filepath_to_url_format($filename_for_metadata); 
    258264    $filename_for_metadata = &util::filename_to_regex($filename_for_metadata); 
     265     
    259266    &extrametautil::setmetadata($extrametadata, $filename_for_metadata, $new_metadata); 
    260267    &extrametautil::addmetakey($extrametakeys, $filename_for_metadata);