Ignore:
Timestamp:
2012-01-10T16:18:19+13:00 (12 years ago)
Author:
ak19
Message:

Diego noticed how the metadata in a toplevel metadata.xml, which specifies metadata for files in import's subfolders, does not get attached to the files on Windows, while this works on Linux. It had to do with the difference between the file slashes used on the OS versus the URL-type fileslashes used in the metadata.xml Diego had constructed. This has now been fixed and Dr Bainbridge came up with a tidier solution of a new method in util.pm that would handle the details.

File:
1 edited

Legend:

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

    r24829 r24932  
    382382    $dirname = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
    383383    }
    384 
     384   
    385385    my $directory_ok = $self->check_directory_path($dirname);
    386386    return $directory_ok unless (defined $directory_ok && $directory_ok == 1);
     
    424424
    425425
    426     my $os_dirsep = &util::get_os_dirsep();
     426    my $os_dirsep = &util::get_os_dirsep();
    427427    my $dirsep    = &util::get_dirsep();
    428428    my $base_dir_regexp = $base_dir;
    429429    $base_dir_regexp =~ s/\//$os_dirsep/g;
    430     my $local_dirname = $dirname;
    431    
    432     $local_dirname =~ s/^$base_dir_regexp($os_dirsep)*//;
     430       
     431    # Want to get relative path of local_dirname within the base_directory
     432    # but with URL style slashes.
     433    my $local_dirname = &util::filename_within_directory_url_format($dirname, $base_dir);
     434
    433435    # if we are in import folder, then local_dirname will be empty
    434436    if ($local_dirname ne "") {
    435     # look for extra metadata passed down from higher folders
    436     $local_dirname .= $dirsep;
     437    # look for extra metadata passed down from higher folders  
     438    $local_dirname .= "/"; # closing slash must be URL type slash also and not $dirsep;
    437439    if (defined $self->{'subdir_extrametakeys'}->{$local_dirname}) {
    438440        my $extrakeys = $self->{'subdir_extrametakeys'}->{$local_dirname};
     
    491493
    492494        my $subdir_extrametakeys = $self->{'subdir_extrametakeys'};
    493 
     495       
    494496        my $subdir_rec = { 're' => $subdir_re, 'md' => $md, 'mf' => $mf };
    495497
Note: See TracChangeset for help on using the changeset viewer.