|
From: Peter O. <obe...@us...> - 2011-05-23 08:03:19
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin
In directory vz-cvs-2.sog:/tmp/cvs-serv16248/bin
Modified Files:
geninfo
Log Message:
geninfo: Make geninfo handle MinGW output on MSYS.
From: Martin Hopfeld <mar...@ss...>
This patch converts path mixtures from MinGW when running on MSYS to correct
MSYS paths.
In solve_relative_path() an additional conversion step will be inserted when
running on MSYS. This will extract the drive letter and convert the remaining
path from Windows pathnames to Unix Paths, which are used by MSYS.
Additionally, if no drive letter is found, the (relative) path is converted to
Unix style. There may be the case where Windows and Unix path separators are
intermixed within one path string.
Index: geninfo
===================================================================
RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/geninfo,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** geninfo 19 Nov 2010 16:15:27 -0000 1.92
--- geninfo 23 May 2011 08:03:13 -0000 1.93
***************
*** 56,60 ****
use Getopt::Long;
use Digest::MD5 qw(md5_base64);
!
# Constants
--- 56,63 ----
use Getopt::Long;
use Digest::MD5 qw(md5_base64);
! if( $^O eq "msys" )
! {
! require File::Spec::Win32;
! }
# Constants
***************
*** 1221,1226 ****
--- 1224,1261 ----
my $path = $_[0];
my $dir = $_[1];
+ my $volume;
+ my $directories;
+ my $filename;
+ my @dirs; # holds path elements
my $result;
+ # Convert from Windows path to msys path
+ if( $^O eq "msys" )
+ {
+ # search for a windows drive letter at the beginning
+ ($volume, $directories, $filename) = File::Spec::Win32->splitpath( $dir );
+ if( $volume ne '' )
+ {
+ my $uppercase_volume;
+ # transform c/d\../e/f\g to Windows style c\d\..\e\f\g
+ $dir = File::Spec::Win32->canonpath( $dir );
+ # use Win32 module to retrieve path components
+ # $uppercase_volume is not used any further
+ ( $uppercase_volume, $directories, $filename ) = File::Spec::Win32->splitpath( $dir );
+ @dirs = File::Spec::Win32->splitdir( $directories );
+
+ # prepend volume, since in msys C: is always mounted to /c
+ $volume =~ s|^([a-zA-Z]+):|/$1|;
+ unshift( @dirs, $volume );
+
+ # transform to Unix style '/' path
+ $directories = File::Spec->catdir( @dirs );
+ $dir = File::Spec->catpath( '', $directories, $filename );
+ } else {
+ # eliminate '\' path separators
+ $dir = File::Spec->canonpath( $dir );
+ }
+ }
+
$result = $dir;
# Prepend path if not absolute
|