Changeset 29818
- Timestamp:
- 2015-03-30T13:44:26+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/DirectoryPlugin.pm
r29796 r29818 410 410 } 411 411 @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; 413 413 closedir (DIR); 414 #$_ = &util::get_dirsep_tail(&util::upgrade_if_dos_filename(&FileUtils::filenameConcatenate($dirname, $_), 1));415 414 # Re-order the files in the list so any directories ending with .all are moved to the end 416 415 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";422 416 if (-d &FileUtils::filenameConcatenate($dirname, $dir[$i]) && $dir[$i] =~ /\.all$/) { 423 417 push(@dir, splice(@dir, $i, 1)); … … 433 427 434 428 435 429 my $os_dirsep = &util::get_os_dirsep(); 436 430 my $dirsep = &util::get_dirsep(); 437 431 my $base_dir_regexp = $base_dir; 438 432 $base_dir_regexp =~ s/\//$os_dirsep/g; 439 433 440 441 442 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); 443 437 444 438 # if we are in import folder, then local_dirname will be empty … … 546 540 last if ($maxdocs != -1 && ($count + $total_count) >= $maxdocs); 547 541 next if ($subfile =~ /^\.\.?$/); 548 print STDERR "poo poo poo\n"; 542 549 543 my $this_file_base_dir = $base_dir; 550 544 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. 551 548 my $unicode_subfile = &util::raw_filename_to_unicode($dirname, $raw_subfile); 552 print STDERR "raw = $raw_subfile, unicode = $unicode_subfile\n";553 554 549 my $raw_file_subfile = &FileUtils::filenameConcatenate($file, $raw_subfile); 555 550 my $raw_full_filename … … 603 598 } 604 599 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. 613 602 if ($additionalmetadata == 1) { 614 603 foreach my $filespec (@extrametakeys) { 615 ## use the url-encoded filename to do the filename comparison616 print STDERR "### comparing against filespec $filespec (";617 print STDERR &unicode::debug_unicode_string("$filespec");618 print STDERR ")\n";619 604 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" 622 606 if ($verbosity > 2); 623 607 my $mdref = &extrametautil::getmetadata(\%extrametadata, $filespec);
Note:
See TracChangeset
for help on using the changeset viewer.