[exim-cvs] Fix relative symlink generation in exim-html/

Góra strony
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Dla: exim-cvs
Temat: [exim-cvs] Fix relative symlink generation in exim-html/
Gitweb: http://git.exim.org/exim-website.git/commitdiff/e5078ee4a13001f3095e1a82bf0dea92f1a6ff60
Commit:     e5078ee4a13001f3095e1a82bf0dea92f1a6ff60
Parent:     5f40eb4fa22982a838e6a6e9cbe1e6080b6d0776
Author:     Todd Lyons <tlyons@???>
AuthorDate: Wed Apr 23 06:26:09 2014 -0700
Committer:  Todd Lyons <tlyons@???>
CommitDate: Wed Apr 23 06:26:09 2014 -0700


    Fix relative symlink generation in exim-html/


    New dependency: File::Basename
---
 script/gen.pl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/script/gen.pl b/script/gen.pl
index fa0cc7e..336f6e1 100755
--- a/script/gen.pl
+++ b/script/gen.pl
@@ -4,6 +4,7 @@ use strict;
use warnings;

 use CSS::Minifier::XS 0.07;
+use File::Basename;
 use File::Copy;
 use File::Find;
 use File::Path qw(make_path);
@@ -230,11 +231,14 @@ sub do_doc {
             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} );
+            # Making a relative symlink to a file in the same directory.
+            # Extract just the filename portion of $real_path.
+            my $real_file = basename($real_path);
+            print "Symlinking  : docroot:/$link_path to $real_file\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: $!";
+            symlink( "$real_file", "$opt{docroot}/$link_path" ) || die "symlink to $opt{docroot}/$link_path failed: $!";
         }
     }
 }