- my $path = sprintf( 'exim-html-%s/doc/html/spec_html/%sch%02d.html', $version, $prepend_chapter, $counter );
- print "Generating : docroot:/$path\n" if ( $opt{verbose} );
- transform( $doc, "$opt{tmpl}/doc/chapter.xsl", "$opt{docroot}/$path", $staticroot );
+ my $real_path = sprintf( 'exim-html-%s/doc/html/spec_html/%sch-%s.html', $version, $prepend_chapter, $chapter_title );
+ my $link_path = sprintf( 'exim-html-%s/doc/html/spec_html/%sch%02d.html', $version, $prepend_chapter, $counter );
+ print "Generating : docroot:/$real_path\n" if ( $opt{verbose} );
+ transform( $doc, "$opt{tmpl}/doc/chapter.xsl", "$opt{docroot}/$real_path", $staticroot );
+ print "Symlinking : docroot:/$link_path to docroot:$real_path\n" if ( $opt{verbose} );
+ if ( -f "$opt{docroot}/$link_path" ) {
+ unlink("$opt{docroot}/$link_path") or die "failed removing $opt{docroot}/$link_path: $!";
+ }
+ symlink( "$opt{docroot}/$real_path", "$opt{docroot}/$link_path" ) || die "symlink to $opt{docroot}/$link_path failed: $!";