Menu

#160 genhtml gets relative path wrong for ./foo

Commands
open
nobody
Tools (21)
5
2012-04-21
2012-04-21
Anonymous
No

I am using genhtml to process the output of js-test-driver's coverage module. The top level page of output looks ok, but drilling down into any directory I found that the css/images were broken; they all linked to one directory above where they should be.

I traced this to get_relative_base_path($). This attempts to calculate the relative path by counting the /s in the path. However, if the path begins ./, there will be an extra / in the count, so it generates the wrong relative path. I hacked the code to read:

my $input = $_[0];
$input =~ s/^\.\///;
# Count number of /s in path
$index = ($input =~ s/\//\//g);

which corrects the count (in this case). I'm not sure how the ./ is creeping in here, but probably I should be blaming js-test-driver for that.

Discussion


Log in to post a comment.