Changeset 20321


Ignore:
Timestamp:
2009-08-18T16:50:01+12:00 (15 years ago)
Author:
kjdon
Message:

use util::locate_config_file instead of hard coding linux paths, for mapping_file and xslt_file. made it work on windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugouts/MARCXMLPlugout.pm

    r17203 r20321  
    4949           'desc' => "{MARCXMLPlugout.mapping_file}",
    5050           'type' => "string",
    51            'deft' => "$ENV{'GSDLHOME'}/etc/dc2marc-mapping.xml",
     51           'deft' => "dc2marc-mapping.xml",
    5252           'reqd' => "yes",   
     53           'hiddengli' => "no"},
     54         { 'name' => "xslt_file",
     55           'desc' => "{BasPlugout.xslt_file}",
     56           'type' => "string",
     57           'reqd' => "no",
     58           'deft' => "dc2marc.xsl",
    5359           'hiddengli' => "no"}
     60
    5461                ];
    5562
     
    7279
    7380    $self->{'buffered_output'} ="";
    74 
    75     if (!defined $self->{'mapping_file'} ||  (defined $self->{'mapping_file'} && $self->{'mapping_file'} eq "")){
    76     $self->{'mapping_file'} = "$ENV{'GSDLHOME'}/etc/dc2marc-mapping.xml";
    77     }
    78    
    79     if (!defined $self->{'xslt_file'} || (defined $self->{'xslt_file'} && $self->{'xslt_file'} eq "")){
    80     $self->{'xslt_file'} = "$ENV{'GSDLHOME'}/etc/dc2marc.xsl";
     81     
     82    my $full_path_to_mapping_file = &util::locate_config_file($self->{'mapping_file'});
     83    if (! defined $full_path_to_mapping_file) {
     84    print STDERR "Can not find $self->{'mapping_file'}, please make sure you have supplied the correct file path\n";
     85    die "\n";
    8186    }
    82  
    83     if(defined $self->{'mapping_file'} &&  $self->{'mapping_file'} ne "")
    84     {
    85     print STDERR "Can not find $self->{'mapping_file'}, please make sure you have supplied the correct file path\n" and  die "\n" unless (-e $self->{'mapping_file'});
    86     }
    87 
    88     if(defined $self->{'xslt_file'} &&  $self->{'xslt_file'} ne "")
    89     {
    90     print STDERR "Can not find $self->{'xslt_file'}, please make sure you have supplied the correct file path\n" and  die "\n" unless (-e $self->{'xslt_file'});
    91     }
     87    $self->{'mapping_file'} = $full_path_to_mapping_file;
    9288
    9389   return bless $self, $class;
     
    112108
    113109    my $output_file = util::filename_cat ($working_dir, "marc.xml");
    114 
     110 
    115111    $self->open_xslt_pipe($output_file,$self->{'xslt_file'});
    116112
     
    157153
    158154    my $output_file = util::filename_cat($output_dir, "marc.xml");
    159 
     155 
    160156    $self->open_xslt_pipe($output_file,$self->{'xslt_file'});
    161157
Note: See TracChangeset for help on using the changeset viewer.