Index: main/trunk/greenstone2/perllib/classify/Phind.pm
===================================================================
--- main/trunk/greenstone2/perllib/classify/Phind.pm	(revision 27903)
+++ main/trunk/greenstone2/perllib/classify/Phind.pm	(revision 27904)
@@ -33,4 +33,5 @@
 
 use BaseClassifier;
+use FileUtils;
 use util;
 use ghtml;
@@ -77,5 +78,5 @@
 		if (!defined $suffix || !defined $wanted_index_files{$suffix}) {
 		    # delete it!
-		    &util::rm (&util::filename_cat ($dir, $file));
+		    &FileUtils::removeFiles (&FileUtils::filenameConcatenate ($dir, $file));
 		}
 	    }
@@ -166,7 +167,7 @@
 
     # Ensure the Phind generate scripts are in place
-    my $file1 = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "suffix");
+    my $file1 = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "suffix");
     $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/;
-    my $src = &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "generate");
+    my $src = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "src", "phind", "generate");
     if (!(-e $file1)) {
 	print STDERR "Phind.pm: ERROR: The Phind \"suffix\" program is not installed.\n\n";
@@ -186,5 +187,5 @@
     $self->{'collectiondir'} = $ENV{'GSDLCOLLECTDIR'}; # collection directories
     if (! defined $self->{'builddir'}) {
-	$self->{'builddir'} = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "building");
+	$self->{'builddir'} = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "building");
     } 
     $self->{'total'} = 0;
@@ -212,8 +213,8 @@
     # create Phind directory
     my $phnumber = 1;
-    my $phinddir = &util::filename_cat($builddir, "phind1");
+    my $phinddir = &FileUtils::filenameConcatenate($builddir, "phind1");
     while (-e "$phinddir") {
 	$phnumber++;
-	$phinddir = &util::filename_cat($builddir, "phind$phnumber");
+	$phinddir = &FileUtils::filenameConcatenate($builddir, "phind$phnumber");
     }
     &util::mk_dir("$phinddir");
@@ -224,6 +225,6 @@
 
     # open filehandles for documents and text
-    my $clausefile =  &util::filename_cat("$phinddir", "clauses");
-    &util::rm($clausefile) if (-e $clausefile);
+    my $clausefile =  &FileUtils::filenameConcatenate("$phinddir", "clauses");
+    &FileUtils::removeFiles($clausefile) if (-e $clausefile);
 
     my $txthandle = 'TEXT' . $phnumber;
@@ -231,6 +232,6 @@
     $self->{'txthandle'} = $txthandle;
 
-    my $docfile = &util::filename_cat("$phinddir", "docs.txt");
-    &util::rm($docfile) if (-e $docfile);
+    my $docfile = &FileUtils::filenameConcatenate("$phinddir", "docs.txt");
+    &FileUtils::removeFiles($docfile) if (-e $docfile);
 
     my $dochandle = 'DOC' . $phnumber;
@@ -392,5 +393,5 @@
     # check that we generated some files. It's not necessarily an error if
     # we didn't (execute() would have quit on error), but we can't go on.
-    my $phrasesfile=&util::filename_cat($self->{'phinddir'}, 'phrases');
+    my $phrasesfile=&FileUtils::filenameConcatenate($self->{'phinddir'}, 'phrases');
     if (! -r $phrasesfile) {
 	print STDERR "<Warning name='NoPhrasesFound'/>\n" if $gli;
@@ -406,6 +407,6 @@
     print $out "\nCreating phrase databases\n";
     print STDERR "<Phase name='PhraseDatabases'/>\n" if $gli;
-    my $mg_input = &util::filename_cat($phinddir, "pdata.txt");
-    my $mg_stem = &util::filename_cat($phinddir, "pdata");
+    my $mg_input = &FileUtils::filenameConcatenate($phinddir, "pdata.txt");
+    my $mg_stem = &FileUtils::filenameConcatenate($phinddir, "pdata");
 
     &execute("mgpp_passes $osextra -f \"$mg_stem\" -T1 \"$mg_input\"", $verbosity, $out);
@@ -416,6 +417,6 @@
     print $out "\nCreating word-level search indexes\n";
     print STDERR "<Phase name='WordLevelIndexes'/>\n" if $gli;
-    $mg_input = &util::filename_cat($phinddir, "pword.txt");
-    $mg_stem = &util::filename_cat($phinddir, "pword");
+    $mg_input = &FileUtils::filenameConcatenate($phinddir, "pword.txt");
+    $mg_stem = &FileUtils::filenameConcatenate($phinddir, "pword");
 
     &execute("mgpp_passes $osextra -f \"$mg_stem\" -T1 -I1 \"$mg_input\"", $verbosity, $out);
@@ -433,6 +434,6 @@
     print $out "\nCreating document information databases\n";
     print STDERR "<Phase name='DocInfoDatabases'/>\n" if $gli;
-    $mg_input = &util::filename_cat($phinddir, "docs.txt");
-    $mg_stem = &util::filename_cat($phinddir, "docs");
+    $mg_input = &FileUtils::filenameConcatenate($phinddir, "docs.txt");
+    $mg_stem = &FileUtils::filenameConcatenate($phinddir, "docs");
 
     &execute("mgpp_passes $osextra -f \"$mg_stem\" -T1 \"$mg_input\"", $verbosity, $out);
@@ -714,5 +715,5 @@
 
     # Read and store the stopwords
-    my $stopdir = &util::filename_cat($ENV{'GSDLHOME'}, "etc", "packages", "phind", "stopword");
+    my $stopdir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "etc", "packages", "phind", "stopword");
     my $stopword_files = ();
     my ($language, $language_dir, $file, $file_name);
@@ -725,5 +726,5 @@
 	# Ignore entries that do not match the classifier's language
 	next unless ($language =~ /$language_exp/);
-	$language_dir = &util::filename_cat($stopdir, $language);
+	$language_dir = &FileUtils::filenameConcatenate($stopdir, $language);
 	next unless (-d "$language_dir");
 
@@ -733,5 +734,5 @@
 	    # Ignore entries that are not stopword files
 	    next unless ($file =~ /sw$/);
-	    $file_name = &util::filename_cat($language_dir, $file);
+	    $file_name = &FileUtils::filenameConcatenate($language_dir, $file);
 	    next unless (-f "$file_name");
 
@@ -756,5 +757,5 @@
 
 	# link file exists
-	$thesaurus_links = &util::filename_cat($collectiondir, "etc", "$thesaurus.lnk");
+	$thesaurus_links = &FileUtils::filenameConcatenate($collectiondir, "etc", "$thesaurus.lnk");
 	die "Cannot find thesaurus link file" unless (-e "$thesaurus_links");
 
@@ -765,5 +766,5 @@
 	    $language = 'en';
 	}
-	$thesaurus_terms = &util::filename_cat($collectiondir, "etc", "$thesaurus.$language");
+	$thesaurus_terms = &FileUtils::filenameConcatenate($collectiondir, "etc", "$thesaurus.$language");
 	die "Cannot find thesaurus term file" unless (-e "$thesaurus_terms");
 	
@@ -905,5 +906,5 @@
     # Output statistics about the vocablary
     print $out "Saving statistics in $phinddir/clauses.stats\n" if ($verbosity > 1);
-    &util::rm("$phinddir/clauses.stats") if (-e "$phinddir/clauses.stats");
+    &FileUtils::removeFiles("$phinddir/clauses.stats") if (-e "$phinddir/clauses.stats");
 
     open(STAT, ">$phinddir/clauses.stats")
@@ -972,5 +973,5 @@
     if ($thesaurus) {
 
-	my $thesaurusfile = &util::filename_cat($phinddir, "$thesaurus.numbers");
+	my $thesaurusfile = &FileUtils::filenameConcatenate($phinddir, "$thesaurus.numbers");
 
 
@@ -1074,6 +1075,6 @@
     
     my $phinddir = $self->{'phinddir'};
-    my $infile = &util::filename_cat($phinddir, 'phrases');
-    my $outfile = &util::filename_cat($phinddir, 'phrases.2');
+    my $infile = &FileUtils::filenameConcatenate($phinddir, 'phrases');
+    my $outfile = &FileUtils::filenameConcatenate($phinddir, 'phrases.2');
 
     # Read the phrase file.  Calculate initial set of phind-id
@@ -1186,6 +1187,6 @@
 
     my $phinddir = $self->{'phinddir'};
-    my $infile = &util::filename_cat($phinddir, "phrases.2");
-    my $outfile = &util::filename_cat($phinddir, "phrases.3");
+    my $infile = &FileUtils::filenameConcatenate($phinddir, "phrases.2");
+    my $outfile = &FileUtils::filenameConcatenate($phinddir, "phrases.3");
 
 
@@ -1194,5 +1195,5 @@
 	print $out "Translate phrases.2: no thesaurus data\n" 
 	    if ($verbosity);
-	&util::mv($infile, $outfile);
+	&FileUtils::moveFiles($infile, $outfile);
 	return;
     }
@@ -1203,5 +1204,5 @@
     # 1.
     # Read thesaurus file and store (symbols->thesaurusid) mapping
-    my $thesaurusfile = &util::filename_cat($phinddir, "$thesaurus.numbers");
+    my $thesaurusfile = &FileUtils::filenameConcatenate($phinddir, "$thesaurus.numbers");
     my %symbolstothesid;
     my (@fields, $thesid, $symbols);
@@ -1276,5 +1277,5 @@
     # Translate thesaurus file, replacing thesaurus-id numbers with 
     # phind-id numbers.
-    my $newthesaurusfile = &util::filename_cat($phinddir, "$thesaurus.phindid");
+    my $newthesaurusfile = &FileUtils::filenameConcatenate($phinddir, "$thesaurus.phindid");
     my ($relations, $linkcounter, $linktext, $linktype, @linkdata);
     my (@links, $linkid, %linkidtotype, $newrelation);
@@ -1416,8 +1417,8 @@
 
     my $phinddir = $self->{'phinddir'};
-    my $infile = &util::filename_cat($phinddir, 'phrases.3');
-    my $vocabfile = &util::filename_cat($phinddir, 'clauses.vocab');
-    my $datafile = &util::filename_cat($phinddir, 'pdata.txt');
-    my $wordfile = &util::filename_cat($phinddir, 'pword.txt');
+    my $infile = &FileUtils::filenameConcatenate($phinddir, 'phrases.3');
+    my $vocabfile = &FileUtils::filenameConcatenate($phinddir, 'clauses.vocab');
+    my $datafile = &FileUtils::filenameConcatenate($phinddir, 'pdata.txt');
+    my $wordfile = &FileUtils::filenameConcatenate($phinddir, 'pword.txt');
 
     my $savephrases = $self->{'savephrases'};
