Ignore:
Timestamp:
2013-10-30T20:54:49+13:00 (10 years ago)
Author:
ak19
Message:
  1. New subroutine util::set_gnomelib_env that sets the environment for gnomelib needed for running hashfile, suffix and wget which are dependent on the libiconv dll in ext/gnome-lib(-minimal). It's particularly the Mac Lions that need libiconv.2.dylib. 2. Updated the call to hashfile in doc.pm, the call to suffix in Phind.pm and the calls to wget in several perl scripts and modules to call util::set_gnomelib_env, though this will only set the environment once for each subshell.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/explode_metadata_database.pl

    r27901 r28560  
    1414use encodings;
    1515use extrametautil;
     16use util;
     17use FileUtils;
    1618use printusage;
    1719use parse2;
     
    8789    'type' => "string",
    8890    # parsearg left "" as default
    89     #'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
     91    #'deft' => &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect"),
    9092    'deft' => "",
    9193    'reqd' => "no",
     
    349351
    350352    # Explode means just that: the original file is deleted
    351     &util::rm($filename);
     353    &FileUtils::removeFiles($filename);
    352354    $plugobj->clean_up_after_exploding();
    353355
     
    364366    die "Error: document directory $documents_directory already exists (bailing).\n";
    365367    }
    366     &util::mk_dir($documents_directory);
    367 
    368     my $documents_metadata_xml_file = &util::filename_cat($documents_directory, "metadata.xml");
     368    &FileUtils::makeDirectory($documents_directory);
     369
     370    my $documents_metadata_xml_file = &FileUtils::filenameConcatenate($documents_directory, "metadata.xml");
    369371    if (-e $documents_metadata_xml_file) {
    370372    die "Error: documents metadata.xml file $documents_metadata_xml_file already exists (bailing).\n";
     
    427429            # by first of all stripping any trailing slash and then always ensuring one is used through filename_cat
    428430            $document_prefix =~ s/(\/|\\)$//;
    429             $document_file_full = &util::filename_cat($document_prefix, "$value$document_suffix");
     431            $document_file_full = &FileUtils::filenameConcatenate($document_prefix, "$value$document_suffix");
    430432        } else { # the doc prefix may also contain the prefix of the actual *filename* following the directory
    431433            $document_file_full = $document_prefix . $value . $document_suffix;
     
    560562    $document_file_full =~ /([^\/]+)$/;
    561563    $document_file_name = $1;
    562     $local_document_file = &util::filename_cat($documents_directory, $document_file_name);
     564    $local_document_file = &FileUtils::filenameConcatenate($documents_directory, $document_file_name);
     565
     566    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?)
     567    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
    563568
    564569    my $wget_options = "--quiet";
     
    576581    else {
    577582    # convert the dirseps in filepath to correct dir sep for OS
    578     $document_file_full = &util::filename_cat($document_file_full);
     583    $document_file_full = &FileUtils::filenameConcatenate($document_file_full);
    579584    my $dir_sep = &util::get_os_dirsep();
    580585
     
    588593    if (!$is_absolute) {
    589594        $document_file_full
    590         = &util::filename_cat($orig_base_dir,$document_file_full);
    591     }
    592 
    593     $local_document_file = &util::filename_cat($documents_directory, $document_file_name);
     595        = &FileUtils::filenameConcatenate($orig_base_dir,$document_file_full);
     596    }
     597
     598    $local_document_file = &FileUtils::filenameConcatenate($documents_directory, $document_file_name);
    594599
    595600    if (-e $document_file_full) {
    596         &util::cp($document_file_full, $documents_directory);
     601        &FileUtils::copyFiles($document_file_full, $documents_directory);
    597602    }
    598603   
     
    606611        # file local to metadata record
    607612        # => copy has been made successfully, so remove original
    608         &util::rm($document_file_full);
     613        &FileUtils::removeFiles($document_file_full);
    609614        }
    610615    }
Note: See TracChangeset for help on using the changeset viewer.