Changeset 30353


Ignore:
Timestamp:
12/16/15 15:46:58 (5 years ago)
Author:
jmt12
Message:

Replacing old file util calls with new FileUtil ones - including changing how directories are read (for instances where direct directory reading isn't possible ala HDFS). Commenting out debug statements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/perllib/plugins/DirectoryPlugin.pm

    r30289 r30353  
    8383    my $self = new PrintInfo($pluginlist, $inputargs, $hashArgOptLists);
    8484
    85     print STDERR "INFO: This DirectoryPlugin supports version 2 manifest files\n";
    86 
    8785    if ($self->{'info_only'}) {
    8886    # don't worry about any options or initialisations etc
     
    117115    $self->{'failhandle'} = $failhandle;
    118116
     117    if ($self->{'verbosity'} > 2) {
     118    print "[INFO] This DirectoryPlugin supports version 2 manifest files\n";
     119    }
    119120}
    120121
     
    184185    my $self = shift(@_);
    185186    my ($dirname) = @_;
    186    
    187     return undef unless (-d $dirname);
     187
     188    #return undef unless (-d $dirname);
     189    return undef unless (&FileUtils::directoryExists($dirname));
    188190
    189191    return 0 if ($self->{'block_exp'} ne "" && $dirname =~ /$self->{'block_exp'}/);
     
    318320   
    319321    # find all the files in the directory
    320     if (!opendir (DIR, $dirname)) {
     322    my $rvalue = &FileUtils::readDirectory($dirname);
     323    if (!defined $rvalue) {
    321324    if ($gli) {
    322325        print STDERR "<ProcessingError n='$file' r='Could not read directory $dirname'>\n";
     
    325328    return -1; # error in processing
    326329    }
    327     @dir = sort readdir (DIR);
    328     closedir (DIR);
    329    
     330    @dir = sort @{$rvalue};
     331    #}
     332    #else
     333    #{
     334    #if (!opendir (DIR, $dirname)) {
     335#   if ($gli) {
     336#       print STDERR "<ProcessingError n='$file' r='Could not read directory $dirname'>\n";
     337#   }
     338#   print $outhandle "DirectoryPlugin: WARNING - couldn't read directory $dirname\n";
     339#   return -1; # error in processing
     340 #   }
     341  #  @dir = sort readdir (DIR);
     342   # closedir (DIR);
     343 #   }
     344
     345    ###print "===== Dir contents =====\n";
     346    ###use Devel::Peek;
     347    ###Dump(@dir);
     348    ###print "\n=====              =====\n";
     349
    330350    for (my $i = 0; $i < scalar(@dir); $i++) {
    331351    my $raw_subfile = $dir[$i];
     
    400420    my @dir;
    401421   
    402     print $outhandle "DirectoryPlugin read: getting directory $dirname\n" if ($verbosity > 2);
     422    print $outhandle "DirectoryPlugin processing $dirname\n";
    403423   
    404424    # find all the files in the directory
     
    574594        next;
    575595    }
    576     print STDERR "** DirectoryPlugin processing $raw_full_filename\n";
     596    ###rint STDERR "** DirectoryPlugin processing $raw_full_filename\n";
    577597    # Follow Windows shortcuts
    578598    if ($raw_subfile =~ m/(?i)\.lnk$/ && (($ENV{'GSDLOS'} =~ m/^windows$/i) && ($^O ne "cygwin"))) {
Note: See TracChangeset for help on using the changeset viewer.