Changeset 29818


Ignore:
Timestamp:
2015-03-30T13:44:26+13:00 (9 years ago)
Author:
kjdon
Message:

removing debug and old test code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/DirectoryPlugin.pm

    r29796 r29818  
    410410    }
    411411    @dir = sort readdir (DIR);
    412     map {  $_ = &unicode::raw_filename_to_url_encoded($_);  print STDERR "****$_\n"; } @dir;
     412    map {  $_ = &unicode::raw_filename_to_url_encoded($_);  } @dir;
    413413    closedir (DIR);
    414     #$_ = &util::get_dirsep_tail(&util::upgrade_if_dos_filename(&FileUtils::filenameConcatenate($dirname, $_), 1));
    415414    # Re-order the files in the list so any directories ending with .all are moved to the end
    416415    for (my $i = scalar(@dir) - 1; $i >= 0; $i--) {
    417         #print STDERR "*****file = $dir[$i]\n";
    418             #my $long = &Win32::GetLongPathName(&util::filename_cat($dirname,$dir[$i]));
    419             #print STDERR "long = $long\n";
    420             #my $upgrade = &util::upgrade_if_dos_filename($dir[$i], 1);
    421                 #print STDERR "upgrade = $upgrade\n";
    422416    if (-d &FileUtils::filenameConcatenate($dirname, $dir[$i]) && $dir[$i] =~ /\.all$/) {
    423417        push(@dir, splice(@dir, $i, 1));
     
    433427
    434428
    435     my $os_dirsep = &util::get_os_dirsep();
     429    my $os_dirsep = &util::get_os_dirsep();
    436430    my $dirsep    = &util::get_dirsep();
    437431    my $base_dir_regexp = $base_dir;
    438432    $base_dir_regexp =~ s/\//$os_dirsep/g;
    439433       
    440     # Want to get relative path of local_dirname within the base_directory
    441     # but with URL style slashes.
    442     my $local_dirname = &util::filename_within_directory_url_format($dirname, $base_dir);
     434    # Want to get relative path of local_dirname within the base_directory
     435    # but with URL style slashes.
     436    my $local_dirname = &util::filename_within_directory_url_format($dirname, $base_dir);
    443437
    444438    # if we are in import folder, then local_dirname will be empty
     
    546540    last if ($maxdocs != -1 && ($count + $total_count) >= $maxdocs);
    547541    next if ($subfile =~ /^\.\.?$/);
    548      print STDERR "poo poo poo\n";
     542
    549543    my $this_file_base_dir = $base_dir;
    550544    my $raw_subfile = &unicode::url_encoded_to_raw_filename($subfile);
     545    # get the canonical unicode version of the filename. This may not match
     546    # the filename on the file system. We will use it to compare to regex
     547    # in the metadata table.
    551548    my $unicode_subfile = &util::raw_filename_to_unicode($dirname, $raw_subfile);
    552     print STDERR "raw = $raw_subfile, unicode = $unicode_subfile\n";
    553 
    554549    my $raw_file_subfile = &FileUtils::filenameConcatenate($file, $raw_subfile);
    555550    my $raw_full_filename
     
    603598    }
    604599
    605     ### $subfile by this point is url-encoded => all ASCII chars => no need to encode as UTF8
    606        print STDERR "****** subfile = $subfile, raw_subfile = $raw_subfile\n";
    607     print STDERR &unicode::debug_unicode_string("subfile = $subfile, raw_subfile = $raw_subfile\n");
    608     print STDERR "looking up unicode version $unicode_subfile (". &unicode::debug_unicode_string($unicode_subfile).") \n";
    609     # instead of using the subfile, we need unicode aware string
    610     ###my $lookup_name = decode("utf8", $raw_subfile);
    611     ####print STDERR "lookup nmae = $lookup_name ( \n";
    612     # Next add metadata read in XML files (if it is supplied)
     600    ### Now we need to look up the metadata table to see if there is any
     601    # extra metadata for us. We need the canonical unicode version here.
    613602    if ($additionalmetadata == 1) {
    614603        foreach my $filespec (@extrametakeys) {
    615         ## use the url-encoded filename to do the filename comparison
    616         print STDERR "### comparing against filespec $filespec (";
    617         print STDERR &unicode::debug_unicode_string("$filespec");
    618         print STDERR ")\n";
    619604        if ($unicode_subfile =~ /^$filespec$/) {
    620         ###if ($lookup_name =~ /^$filespec$/) {
    621             print $outhandle "^^^^^^^^^File \"$unicode_subfile\" matches filespec \"$filespec\"\n"
     605            print $outhandle "File \"$unicode_subfile\" matches filespec \"$filespec\"\n"
    622606            if ($verbosity > 2);
    623607            my $mdref = &extrametautil::getmetadata(\%extrametadata, $filespec);
Note: See TracChangeset for help on using the changeset viewer.