Changeset 19754

Show
Ignore:
Timestamp:
08.06.2009 13:34:05 (10 years ago)
Author:
ak19
Message:

The document_prefix field of exploding-metadata now has the file-separator appended to the end if it refers to a directory (but not a URL). If it refers to a shared filename prefix then no file-sep will be appended.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/explode_metadata_database.pl

    r19747 r19754  
    402402 
    403403        $value =~ s/\\\\/\\/g; 
     404        my $document_file_full; 
    404405 
    405406        # Does this metadata element specify a document to obtain? 
    406407        if ($field eq $document_field) { 
    407         # shouldn't force a slash at the end after all, since the doc prefix may already 
    408         # contain the prefix of the actual filename itself (that's shared over several docs)  
    409         my $document_file_full = $document_prefix . $value . $document_suffix; 
     408        if(-d $document_prefix && $document_prefix !~ m@^(http|ftp|https)://@ ) { 
     409            # if the document-prefix refers to a directory but not URL, ensure it has a file-separator at the end 
     410            # by first of all stripping any trailing slash and then always ensuring one is used through filename_cat 
     411            $document_prefix =~ s/(\/|\\)$//; 
     412            $document_file_full = &util::filename_cat($document_prefix, "$value$document_suffix"); 
     413        } else { # the doc prefix may also contain the prefix of the actual *filename* following the directory 
     414            $document_file_full = $document_prefix . $value . $document_suffix; 
     415        } 
    410416 
    411417        # this either downloads/copies the document, or creates a nul file for it.