summaryrefslogtreecommitdiffstats
path: root/Doc/perl
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-03-10 23:02:57 (GMT)
committerFred Drake <fdrake@acm.org>1998-03-10 23:02:57 (GMT)
commitdb34a1e2d8c95d64df5c8e6b6c5dd2246ee4cb09 (patch)
tree7bc6fcfebf5b9405f25fef71a2c5e419734586da /Doc/perl
parenteff1f7622aaa4d0ba180290f614e49543e05eef1 (diff)
downloadcpython-db34a1e2d8c95d64df5c8e6b6c5dd2246ee4cb09.zip
cpython-db34a1e2d8c95d64df5c8e6b6c5dd2246ee4cb09.tar.gz
cpython-db34a1e2d8c95d64df5c8e6b6c5dd2246ee4cb09.tar.bz2
Use the location of the initialization file to augment the style-specific
.perl file search path, rather than making assumptions about the current directory.
Diffstat (limited to 'Doc/perl')
-rw-r--r--Doc/perl/l2hinit.perl28
1 files changed, 23 insertions, 5 deletions
diff --git a/Doc/perl/l2hinit.perl b/Doc/perl/l2hinit.perl
index 4da0963..96146e9 100644
--- a/Doc/perl/l2hinit.perl
+++ b/Doc/perl/l2hinit.perl
@@ -16,12 +16,30 @@ $ICONSERVER = '../icons';
$CHILDLINE = "\n<p><hr>\n";
$VERBOSITY = 0;
-# a little painful, but lets us clean up the top level directory just a little
-$mywd = `pwd`;
-chop $mywd;
-$LATEX2HTMLSTYLES = "$mywd${dd}perl$envkey$LATEX2HTMLSTYLES";
+# Locate a file that's been "require"d. Assumes that the file name of interest
+# is unique within the set of loaded files, after directory names have been
+# stripped. Only the directory is returned.
+#
+sub find_my_file{
+ local($myfile,$key,$tmp,$mydir) = (@_[0], '', '', '');
+ foreach $key (keys %INC) {
+ $tmp = "$key";
+ $tmp =~ s|^.*/||o;
+ if ($tmp eq $myfile) {
+ #print "\nfound $tmp: $key --> ", $INC{$key}, "\n";
+ $mydir = $INC{$key};
+ }
+ }
+ $mydir =~ s|/[^/]*$||;
+ $mydir;
+}
-#print "\n\$LATEX2HTMLSTYLES = $LATEX2HTMLSTYLES\n\n";
+# A little painful, but lets us clean up the top level directory a little,
+# and not be tied to the current directory (as far as I can tell).
+#
+$mydir = &find_my_file("l2hinit.perl");
+#print "\nmy dir = $mydir\n";
+$LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES";
sub top_navigation_panel {