Ignore:
Timestamp:
2013-05-06T15:29:38+12:00 (11 years ago)
Author:
jmt12
Message:

Moving the critical file-related functions (copy, rm, etc) out of util.pm into their own proper class FileUtils. Use of the old functions in util.pm will prompt deprecated warning messages. There may be further functions that could be moved across in the future, but these are the critical ones when considering supporting other filesystems (HTTP, HDFS, WebDav, etc). Updated some key files to use the new functions so now deprecated messages thrown when importing/building demo collection 'out of the box'

File:
1 edited

Legend:

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

    r27188 r27306  
    3939no strict 'refs';
    4040use util;
     41use FileUtils;
    4142
    4243BEGIN {
     
    7879    # For incremental building need to seed num_docs etc from values
    7980    # stored in build.cfg (if present)
    80     $buildconfigfile = &util::filename_cat($build_dir, "build.cfg");
     81    $buildconfigfile = &FileUtils::filenameConcatenate($build_dir, "build.cfg");
    8182    if (-e $buildconfigfile) {
    8283        $found_num_data = 1;
     
    8485    else {
    8586        # try the index dir
    86         $buildconfigfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},
     87        $buildconfigfile = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},
    8788                           "index", "build.cfg");
    8889        if (-e $buildconfigfile) {
     
    835836    # dir, otherwise it is relative to the HASH... directory
    836837    if ($assoc_file->[1] =~ m@^[/\\]@) {
    837         $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]);
     838        $afile = &FileUtils::filenameConcatenate($self->{'assocdir'}, $assoc_file->[1]);
    838839    } else {
    839         $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
     840        $afile = &FileUtils::filenameConcatenate($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
    840841    }
    841842   
    842     &util::hard_link ($assoc_file->[0], $afile, $self->{'verbosity'});
     843    &FileUtils::hardLink($assoc_file->[0], $afile, $self->{'verbosity'});
    843844    }
    844845}
     
    849850    my ($archivedir, $edit_mode) = @_;
    850851
    851     my $assoc_dir = &util::filename_cat($self->{'assocdir'}, $archivedir);
     852    my $assoc_dir = &FileUtils::filenameConcatenate($self->{'assocdir'}, $archivedir);
    852853    if (-d $assoc_dir) {
    853     &util::rm_r($assoc_dir);
    854     }
    855 }
     854    &FileUtils::removeFilesRecursive($assoc_dir);
     855    }
     856}
Note: See TracChangeset for help on using the changeset viewer.