Ignore:
Timestamp:
2006-03-13T13:11:54+13:00 (16 years ago)
Author:
mdewsnip
Message:

Errors reading the .fdt or .xrf files are now reported back to the GLI nicely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/ISISPlug.pm

    r11332 r11334  
    117117    my $self = shift (@_);
    118118    my ($filename, $encoding, $language, $textref) = @_;
    119 
    120     my ($databasename) = ($filename =~ /(.*)\.mst$/i);
     119    my $outhandle = $self->{'outhandle'};
     120
     121    my ($database_file_path_root) = ($filename =~ /(.*)\.mst$/i);
     122    my $mst_file_path_relative = $filename;
     123    $mst_file_path_relative =~ s/^.+import.(.*?)$/$1/;
    121124
    122125    # Check the associated .fdt and .xrf files exist
    123126    # These files must have a lowercase extension for the IsisGdl program to work
    124127    # Bailing out because of this is kind of crappy but it is only an issue on Unix
    125     $self->{'fdt_filename'} = $databasename . ".fdt";
    126     if (!-e $self->{'fdt_filename'}) {
    127     die "Error: Could not find ISIS FDT file " . $self->{'fdt_filename'} . ".\n";
     128    $self->{'fdt_file_path'} = $database_file_path_root . ".fdt";
     129    if (!-e $self->{'fdt_file_path'}) {
     130    print STDERR "<ProcessingError n='$mst_file_path_relative' r='Could not find ISIS FDT file $self->{'fdt_file_path'}'>\n" if ($self->{'gli'});
     131    print $outhandle "Error: Could not find ISIS FDT file " . $self->{'fdt_file_path'} . ".\n";
     132    return;
    128133    }
    129     $self->{'xrf_filename'} = $databasename . ".xrf";
    130     if (!-e $self->{'xrf_filename'}) {
    131     die "Error: Could not find ISIS XRF file " . $self->{'xrf_filename'} . ".\n";
     134    $self->{'xrf_file_path'} = $database_file_path_root . ".xrf";
     135    if (!-e $self->{'xrf_file_path'}) {
     136    print STDERR "<ProcessingError n='$mst_file_path_relative' r='Could not find ISIS XRF file $self->{'xrf_file_path'}'>\n" if ($self->{'gli'});
     137    print $outhandle "Error: Could not find ISIS XRF file " . $self->{'xrf_file_path'} . ".\n";
     138    return;
    132139    }
    133140
     
    143150
    144151    # Parse the associated ISIS database Field Definition Table file (.fdt)
    145     my %fdt_mapping = &parse_field_definition_table($self->{'fdt_filename'}, $encoding);
     152    my %fdt_mapping = &parse_field_definition_table($self->{'fdt_file_path'}, $encoding);
    146153    $self->{'fdt_mapping'} = \%fdt_mapping;
    147154
     
    346353
    347354    # Delete the FDT and XRF files too
    348     &util::rm($self->{'fdt_filename'});
    349     &util::rm($self->{'xrf_filename'});
     355    &util::rm($self->{'fdt_file_path'});
     356    &util::rm($self->{'xrf_file_path'});
    350357}
    351358
Note: See TracChangeset for help on using the changeset viewer.