[LON-CAPA-cvs] cvs: doc /help rebuildLabelHash.pl
bowersj2
lon-capa-cvs@mail.lon-capa.org
Thu, 18 Jul 2002 19:57:14 -0000
bowersj2 Thu Jul 18 15:57:14 2002 EDT
Modified files:
/doc/help rebuildLabelHash.pl
Log:
Previous version didn't work correctly. This should.
Index: doc/help/rebuildLabelHash.pl
diff -u doc/help/rebuildLabelHash.pl:1.2 doc/help/rebuildLabelHash.pl:1.3
--- doc/help/rebuildLabelHash.pl:1.2 Wed Jul 17 11:47:15 2002
+++ doc/help/rebuildLabelHash.pl Thu Jul 18 15:57:14 2002
@@ -29,22 +29,28 @@
use strict;
use GDBM_File;
+use File::Spec;
-my $dirprefix = "../../loncom/html/adm/help/";
+# I had to chdir, because neither glob nor bsd_glob accept globs
+# with ".." in them... sucky.
+chdir "../../loncom/html/adm/help/";
# if the topic hash exists, kill it
-unlink 'fragmentLabels.gdbm' if ( -e $dirprefix . 'fragmentTopics.gdbm' );
+unlink 'fragmentLabels.gdbm' if ( -e 'fragmentLabels.gdbm' );
+print "Wiped old fragmentLabels.gdbm.\n";
-tie (my %fragmentLabels, 'GDBM_File', $dirprefix . 'fragmentLabels.gdbm', 1, 0);
+tie (my %fragmentLabels, 'GDBM_File', 'fragmentLabels.gdbm', 1, 0);
my $error = 0;
-chdir $dirprefix;
+chdir "tex";
-while (<*.tex>)
+foreach my $file ( glob("*.tex") )
{
- my $file;
- $file = $_;
open F, $file;
+ if ( index($file, "/") != "/" )
+ {
+ $file = substr($file, index($file, "/") + 1);
+ }
my $contents = join("\n", <F>);
my $label;