Changeset 2509
- Timestamp:
- 2001-06-07T21:53:32+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/phind.pm
r2507 r2509 38 38 use unicode; 39 39 40 my @removedirs = (); 41 42 my %wanted_index_files = ('td'=>1, 43 't'=>1, 44 'ti'=>1, 45 'tl'=>1, 46 'tsd'=>1, 47 'idb'=>1, 48 'ib1'=>1, 49 'ib2'=>1, 50 'ib3'=>1, 51 'i'=>1, 52 'il'=>1, 53 'w'=>1, 54 'wa'=>1); 55 40 56 sub BEGIN { 41 57 @ISA = ('BasClas'); 42 58 } 43 59 60 sub END { 61 62 # Tidy up stray files - we do this here as there's some weird problem 63 # preventing us from doing it in the get_classify_info() function (on 64 # windows at least) where the close() appears to fail on txthandle and 65 # dochandle, thus preventing us from deleting those files 66 67 foreach my $dir (@removedirs) { 68 if (-d $dir && opendir (DIR, $dir)) { 69 my @files = readdir DIR; 70 closedir DIR; 71 72 foreach $file (@files) { 73 next if $file =~ /^\.\.?$/; 74 my ($suffix) = $file =~ /\.([^\.]+)$/; 75 if (!defined $suffix || !defined $wanted_index_files{$suffix}) { 76 # delete it! 77 &util::rm (&util::filename_cat ($dir, $file)); 78 } 79 } 80 } 81 } 82 } 44 83 45 84 sub print_usage { … … 83 122 "; } 84 123 85 86 %wanted_index_files = ('td'=>1,87 't'=>1,88 'ti'=>1,89 'tl'=>1,90 'tsd'=>1,91 'idb'=>1,92 'ib1'=>1,93 'ib2'=>1,94 'ib3'=>1,95 'i'=>1,96 'il'=>1,97 'w'=>1,98 'wa'=>1);99 100 101 102 124 # Phrase delimiter symbols - these should be abstracted out someplace 103 125 … … 116 138 117 139 my $out = $self->{'outhandle'}; 118 119 120 # Phind installation check121 # The phind phrase browser is research software and is not installed122 # by defualt. If the user attepts to use it we warn them that it's a123 # bit dodgy, then tell them how to install it. If they can do that124 # and get all the files in place, then we let them proceed.125 126 print $out "Checking Phind phrase browser requirements...\n";127 140 128 141 # Ensure the Phind generate scripts are in place … … 194 207 $self->{'phindnumber'} = $phnumber; 195 208 209 push(@removedirs, $phinddir) unless $self->{'untidy'}; 210 196 211 # open filehandles for documents and text 197 212 my $clausefile = &util::filename_cat("$phinddir", "clauses"); … … 386 401 &execute("mgpp_passes $osextra -f $mg_stem -T2 $mg_input", $verbosity, $out); 387 402 388 # Tidy up stray files389 if (!$self->{'untidy'}) {390 print $out "\nCleaning up\n" if ($verbosity > 2);391 opendir (DIR, $phinddir) || die;392 my @files = readdir DIR;393 closedir DIR;394 395 foreach $file (@files) {396 next if $file =~ /^\.\.?$/;397 my ($suffix) = $file =~ /\.([^\.]+)$/;398 if (!defined $suffix || !defined $wanted_index_files{$suffix}) {399 # delete it!400 print $out "deleting $file\n"; # if $verbosity > 2;401 &util::rm (&util::filename_cat ($phinddir, $file));402 }403 }404 }405 406 403 # Return the information about the classifier that we'll later want to 407 404 # use to create macros when the Phind classifier document is displayed.
Note:
See TracChangeset
for help on using the changeset viewer.