Changeset 27535


Ignore:
Timestamp:
06/04/13 16:09:13 (8 years ago)
Author:
ak19
Message:

Using the recommended FileUtils' subroutines for the deprecated utils.pm equivalents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/mgbuilder.pm

    r24404 r27535  
    3030use strict; no strict 'refs';
    3131use util;
     32use FileUtils;
    3233
    3334
     
    130131    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
    131132    my $exe = &util::get_os_exe ();
    132     my $mg_passes_exe = &util::filename_cat($exedir, "mg_passes$exe");
    133     my $mg_compression_dict_exe = &util::filename_cat($exedir, "mg_compression_dict$exe");
     133    my $mg_passes_exe = &FileUtils::filenameConcatenate($exedir, "mg_passes$exe");
     134    my $mg_compression_dict_exe = &FileUtils::filenameConcatenate($exedir, "mg_compression_dict$exe");
    134135    my $outhandle = $self->{'outhandle'};
    135136
    136137    my $maxnumeric = $self->{'maxnumeric'};
    137138
    138     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, "text"));
     139    &FileUtils::makeAllDirectories (&FileUtils::filenameConcatenate($self->{'build_dir'}, "text"));
    139140
    140141    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
    141     my $basefilename = &util::filename_cat("text",$collect_tail);
    142     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, $basefilename);
     142    my $basefilename = &FileUtils::filenameConcatenate("text",$collect_tail);
     143    my $fulltextprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, $basefilename);
    143144
    144145    my $osextra = "";
     
    328329    # get the full index directory path and make sure it exists
    329330    my $indexdir = $self->{'index_mapping'}->{$index};
    330     &util::mk_all_dir (&util::filename_cat($self->{'build_dir'}, $indexdir));
     331    &FileUtils::makeAllDirectories (&FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir));
    331332
    332333    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
    333     my $fullindexprefix = &util::filename_cat ($self->{'build_dir'}, $indexdir,
     334    my $fullindexprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir,
    334335                           $collect_tail);
    335     my $fulltextprefix = &util::filename_cat ($self->{'build_dir'}, "text",
     336    my $fulltextprefix = &FileUtils::filenameConcatenate($self->{'build_dir'}, "text",
    336337                           $collect_tail);
    337338
     
    339340    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
    340341    my $exe = &util::get_os_exe ();
    341     my $mg_passes_exe = &util::filename_cat($exedir, "mg_passes$exe");
     342    my $mg_passes_exe = &FileUtils::filenameConcatenate($exedir, "mg_passes$exe");
    342343    my $mg_perf_hash_build_exe =
    343     &util::filename_cat($exedir, "mg_perf_hash_build$exe");
     344    &FileUtils::filenameConcatenate($exedir, "mg_perf_hash_build$exe");
    344345    my $mg_weights_build_exe =
    345     &util::filename_cat ($exedir, "mg_weights_build$exe");
     346    &FileUtils::filenameConcatenate($exedir, "mg_weights_build$exe");
    346347    my $mg_invf_dict_exe =
    347     &util::filename_cat ($exedir, "mg_invf_dict$exe");
     348    &FileUtils::filenameConcatenate($exedir, "mg_invf_dict$exe");
    348349    my $mg_stem_idx_exe =
    349     &util::filename_cat ($exedir, "mg_stem_idx$exe");
     350    &FileUtils::filenameConcatenate($exedir, "mg_stem_idx$exe");
    350351
    351352    my $maxnumeric = $self->{'maxnumeric'};
     
    516517
    517518    # remove unwanted files
    518     my $tmpdir = &util::filename_cat ($self->{'build_dir'}, $indexdir);
     519    my $tmpdir = &FileUtils::filenameConcatenate($self->{'build_dir'}, $indexdir);
    519520    opendir (DIR, $tmpdir) || die
    520521        "mgbuilder::build_index - couldn't read directory $tmpdir\n";
     
    525526        # delete it!
    526527        print $outhandle "deleting $file\n" if $self->{'verbosity'} > 2;
    527         &util::rm (&util::filename_cat ($tmpdir, $file));
     528        &FileUtils::removeFiles (&FileUtils::filenameConcatenate($tmpdir, $file));
    528529        }
    529530    }
     
    540541    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
    541542    my $exe = &util::get_os_exe ();
    542     my $mgstat_exe = &util::filename_cat($exedir, "mgstat$exe");
     543    my $mgstat_exe = &FileUtils::filenameConcatenate($exedir, "mgstat$exe");
    543544
    544545    my $collect_tail = &util::get_dirsep_tail($self->{'collection'});
    545     my $input_file = &util::filename_cat ("text", $collect_tail);
     546    my $input_file = &FileUtils::filenameConcatenate("text", $collect_tail);
    546547    if (!-e "$mgstat_exe" || !open (PIPEIN, "mgstat$exe -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) {
    547548    my $outhandle = $self->{'outhandle'};
Note: See TracChangeset for help on using the changeset viewer.