stas 2002/06/16 19:58:22 Modified: lib/DocSet RunTime.pm Util.pm Log: DocSet sync: - provide a fix for File::Spec->abs2rel for WIN32 [Per Einar Ellefsen <[EMAIL PROTECTED]>] Revision Changes Path 1.9 +5 -3 modperl-docs/lib/DocSet/RunTime.pm Index: RunTime.pm =================================================================== RCS file: /home/cvs/modperl-docs/lib/DocSet/RunTime.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- RunTime.pm 15 Jun 2002 18:20:33 -0000 1.8 +++ RunTime.pm 17 Jun 2002 02:58:22 -0000 1.9 @@ -6,7 +6,7 @@ use strict; use warnings; -use File::Spec::Functions qw(catdir catfile splitdir abs2rel); +use File::Spec::Functions qw(catdir catfile splitdir); use File::Find; use DocSet::Util; @@ -101,8 +101,10 @@ my $rel_uri = path2uri($rel_path); $src_docs{$rel_uri} = { - map { s/config\.cfg$/index.html/; ($_ => 1) } # autogenerated index.html - map path2uri( abs2rel($_, $full_base_path) ), # full path=>relative uri + # autogenerated index.html + map { s/config\.cfg$/index.html/; ($_ => 1) } + # full path => relative uri + map path2uri( DocSet::Util::abs2rel($_, $full_base_path) ), grep $rsub_keep_ext->($_), # get files with wanted exts grep !$rsub_skip_seen->($_), # skip seen base dirs @{ expand_dir($full_base_path) } 1.13 +14 -0 modperl-docs/lib/DocSet/Util.pm Index: Util.pm =================================================================== RCS file: /home/cvs/modperl-docs/lib/DocSet/Util.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Util.pm 11 Jun 2002 15:02:10 -0000 1.12 +++ Util.pm 17 Jun 2002 02:58:22 -0000 1.13 @@ -11,11 +11,13 @@ use Data::Dumper; use Carp; use Template; +use File::Spec; use File::Spec::Functions; require DocSet::RunTime; # interdependency with DocSet::Util use constant IS_WIN32 => $^O eq 'MSWin32'; +use constant PERL_LT_580 => $] < 5.008; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @@ -135,6 +137,18 @@ return unless defined $_[0]; return join '/', File::Spec->splitdir(shift); } + +# File::Spec->abs2rel doesn't strip the volume (e.g. /^c:/) before +# Perl v5.8.0 on Win32. This function fixes this bug. +# +# Make sure to call this function as DocSet::Util::abs2rel, especially +# in the code that already uses File::Spec functions. +sub abs2rel { + my $res = File::Spec->abs2rel(@_); + $res =~ s/^[a-zA-Z]:// if IS_WIN32 && PERL_LT_580 && defined $res; + $res; +} + sub get_date { sprintf "%s %d, %d", (split /\s+/, scalar localtime)[1,2,4];
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]