| 1 | package File::Spec::Win32; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Cwd (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | require File::Spec::Unix; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | our $VERSION = '3.75'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | our @ISA = qw(File::Spec::Unix); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # Some regexes we use for path splitting | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | my $DRIVE_RX = '[a-zA-Z]:'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | my $UNC_RX = '(?:\\\\\\\\|//)[^\\\\/]+[\\\\/][^\\\\/]+'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my $VOL_RX = "(?:$DRIVE_RX|$UNC_RX)"; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | File::Spec::Win32 - methods for Win32 file specs | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | require File::Spec::Win32; # Done internally by File::Spec if needed | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | See File::Spec::Unix for a documentation of the methods provided | ||||||||||||||||||||||||||||||||||||||||||
| 30 | there. This package overrides the implementation of these methods, not | ||||||||||||||||||||||||||||||||||||||||||
| 31 | the semantics. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | =item devnull | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | Returns a string representation of the null device. | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub devnull { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
devnull: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return "nul"; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 32 | ▶ | sub rootdir { '\\' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rootdir: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =item tmpdir | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | Returns a string representation of the first existing directory | ||||||||||||||||||||||||||||||||||||||||||
| 51 | from the following list: | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | $ENV{TMPDIR} | ||||||||||||||||||||||||||||||||||||||||||
| 54 | $ENV{TEMP} | ||||||||||||||||||||||||||||||||||||||||||
| 55 | $ENV{TMP} | ||||||||||||||||||||||||||||||||||||||||||
| 56 | SYS:/temp | ||||||||||||||||||||||||||||||||||||||||||
| 57 | C:\system\temp | ||||||||||||||||||||||||||||||||||||||||||
| 58 | C:/temp | ||||||||||||||||||||||||||||||||||||||||||
| 59 | /tmp | ||||||||||||||||||||||||||||||||||||||||||
| 60 | / | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | The SYS:/temp is preferred in Novell NetWare and the C:\system\temp | ||||||||||||||||||||||||||||||||||||||||||
| 63 | for Symbian (the File::Spec::Win32 is used also for those platforms). | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | If running under taint mode, and if the environment | ||||||||||||||||||||||||||||||||||||||||||
| 66 | variables are tainted, they are not used. | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | ▶ | sub tmpdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tmpdir: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | my $tmpdir = $_[0]->_cached_tmpdir(qw(TMPDIR TEMP TMP)); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | ▶ | return $tmpdir if defined $tmpdir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | $tmpdir = $_[0]->_tmpdir( map( $ENV{$_}, qw(TMPDIR TEMP TMP) ), | |||||||||||||||||||||||||||||||||||||||||
| 74 | 'SYS:/temp', | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 'C:\system\temp', | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 'C:/temp', | ||||||||||||||||||||||||||||||||||||||||||
| 77 | '/tmp', | ||||||||||||||||||||||||||||||||||||||||||
| 78 | '/' ); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | $_[0]->_cache_tmpdir($tmpdir, qw(TMPDIR TEMP TMP)); | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =item case_tolerant | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | MSWin32 case-tolerance depends on GetVolumeInformation() $ouFsFlags == FS_CASE_SENSITIVE, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | indicating the case significance when comparing file specifications. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | See http://cygwin.com/ml/cygwin/2007-07/msg00891.html | ||||||||||||||||||||||||||||||||||||||||||
| 88 | Default: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | sub case_tolerant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
case_tolerant: called CC=5 SCAR=26.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | ▶ | eval { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | local @INC = @INC; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | pop @INC if $INC[-1] eq '.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | require Win32API::File; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } or return 1; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $drive = shift || "C:"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'C:'
MC/DC0%0/1
shift() || 'C:'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $osFsType = "\0"x256; | |||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $osVolName = "\0"x256; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $ouFsFlags = 0; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | Win32API::File::GetVolumeInformation($drive, $osVolName, 256, [], [], $ouFsFlags, $osFsType, 256 ); | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($ouFsFlags & Win32API::File::FS_CASE_SENSITIVE()) { return 0; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | else { return 1; } | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | =item file_name_is_absolute | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | As of right now, this returns 2 if the path is absolute with a | ||||||||||||||||||||||||||||||||||||||||||
| 110 | volume, 1 if it's absolute with no volume, 0 otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 152 | ▶ | sub file_name_is_absolute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_name_is_absolute: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 152 | my ($self,$file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 152 | ▶ | if ($file =~ m{^($VOL_RX)}o) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 74 | my $vol = $1; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 74 | ▶ | return ($vol =~ m{^$UNC_RX}o ? 2 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | : $file =~ m{^$DRIVE_RX[\\/]}o ? 2 | ||||||||||||||||||||||||||||||||||||||||||
| 122 | : 0); | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 78 | ▶ | return $file =~ m{^[\\/]} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | =item catfile | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | Concatenate one or more directory names and a filename to form a | ||||||||||||||||||||||||||||||||||||||||||
| 130 | complete path ending with a filename | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 11 | ▶ | sub catfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catfile: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 11 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | # Legacy / compatibility support | ||||||||||||||||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 11 | ▶ | shift, return _canon_cat( "/", @_ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | if $_[0] eq ""; | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | # Compatibility with File::Spec <= 3.26: | ||||||||||||||||||||||||||||||||||||||||||
| 143 | # catfile('A:', 'foo') should return 'A:\foo'. | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 11 | ▶ | return _canon_cat( ($_[0].'\\'), @_[1..$#_] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | if $_[0] =~ m{^$DRIVE_RX\z}o; | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 10 | return _canon_cat( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 69 | ▶ | sub catdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catdir: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 69 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | # Legacy / compatibility support | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 69 | ▶ | return "" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | unless @_; | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 68 | ▶ | shift, return _canon_cat( "/", @_ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | if $_[0] eq ""; | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | # Compatibility with File::Spec <= 3.26: | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # catdir('A:', 'foo') should return 'A:\foo'. | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 54 | ▶ | return _canon_cat( ($_[0].'\\'), @_[1..$#_] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | if $_[0] =~ m{^$DRIVE_RX\z}o; | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 53 | return _canon_cat( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my @path = split(';', $ENV{PATH}); | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | s/"//g for @path; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | @path = grep length, @path; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | unshift(@path, "."); | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | return @path; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | =item canonpath | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | No physical check on the filesystem, but a logical cleanup of a | ||||||||||||||||||||||||||||||||||||||||||
| 179 | path. On UNIX eliminated successive slashes and successive "/.". | ||||||||||||||||||||||||||||||||||||||||||
| 180 | On Win32 makes | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | dir1\dir2\dir3\..\..\dir4 -> \dir\dir4 and even | ||||||||||||||||||||||||||||||||||||||||||
| 183 | dir1\dir2\dir3\...\dir4 -> \dir\dir4 | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 192 | ▶ | sub canonpath { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonpath: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | # Legacy / compatibility support | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 192 | ▶ | return $_[1] if !defined($_[1]) or $_[1] eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $_[1] or $_[1] eq ""
MC/DC100%2/2
not defined $_[1] or $_[1] eq ""
not defined $_[1]
$_[1] eq ""
Truth table100%3/3
not(A) or B
A= not defined $_[1]B= $_[1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 189 | return _canon_cat( $_[1] ); | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | =item splitpath | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | ($volume,$directories,$file) = File::Spec->splitpath( $path ); | ||||||||||||||||||||||||||||||||||||||||||
| 197 | ($volume,$directories,$file) = File::Spec->splitpath( $path, | ||||||||||||||||||||||||||||||||||||||||||
| 198 | $no_file ); | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | Splits a path into volume, directory, and filename portions. Assumes that | ||||||||||||||||||||||||||||||||||||||||||
| 201 | the last file is a path unless the path ends in '\\', '\\.', '\\..' | ||||||||||||||||||||||||||||||||||||||||||
| 202 | or $no_file is true. On Win32 this means that $no_file true makes this return | ||||||||||||||||||||||||||||||||||||||||||
| 203 | ( $volume, $path, '' ). | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | Separators accepted are \ and /. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | Volumes can be drive letters or UNC sharenames (\\server\share). | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | The results can be passed to L</catpath> to get back a path equivalent to | ||||||||||||||||||||||||||||||||||||||||||
| 210 | (usually identical to) the original path. | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 191 | ▶ | sub splitpath { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splitpath: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 191 | my ($self,$path, $nofile) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 191 | my ($volume,$directory,$file) = ('','',''); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 191 | ▶ | if ( $nofile ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 128 | $path =~ | |||||||||||||||||||||||||||||||||||||||||
| 219 | m{^ ( $VOL_RX ? ) (.*) }sox; | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 128 | $volume = $1; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 128 | $directory = $2; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 63 | $path =~ | |||||||||||||||||||||||||||||||||||||||||
| 225 | m{^ ( $VOL_RX ? ) | ||||||||||||||||||||||||||||||||||||||||||
| 226 | ( (?:.*[\\/](?:\.\.?\Z(?!\n))?)? ) | ||||||||||||||||||||||||||||||||||||||||||
| 227 | (.*) | ||||||||||||||||||||||||||||||||||||||||||
| 228 | }sox; | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 63 | $volume = $1; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 63 | $directory = $2; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 63 | $file = $3; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 191 | return ($volume,$directory,$file); | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =item splitdir | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | The opposite of L<catdir()|File::Spec/catdir>. | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | @dirs = File::Spec->splitdir( $directories ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | $directories must be only the directory portion of the path on systems | ||||||||||||||||||||||||||||||||||||||||||
| 245 | that have the concept of a volume or that have path syntax that differentiates | ||||||||||||||||||||||||||||||||||||||||||
| 246 | files from directories. | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | Unlike just splitting the directories on the separator, leading empty and | ||||||||||||||||||||||||||||||||||||||||||
| 249 | trailing directory entries can be returned, because these are significant | ||||||||||||||||||||||||||||||||||||||||||
| 250 | on some OSs. So, | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | File::Spec->splitdir( "/a/b/c" ); | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | Yields: | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | ( '', 'a', 'b', '', 'c', '' ) | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 44 | ▶ | sub splitdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splitdir: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 44 | my ($self,$directories) = @_ ; | |||||||||||||||||||||||||||||||||||||||||
| 262 | # | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # split() likes to forget about trailing null fields, so here we | ||||||||||||||||||||||||||||||||||||||||||
| 264 | # check to be sure that there will not be any before handling the | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # simple case. | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 44 | ▶ | if ( $directories !~ m|[\\/]\Z(?!\n)| ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 36 | return split( m|[\\/]|, $directories ); | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 271 | # | ||||||||||||||||||||||||||||||||||||||||||
| 272 | # since there was a trailing separator, add a file name to the end, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # then do the split, then replace it with ''. | ||||||||||||||||||||||||||||||||||||||||||
| 274 | # | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 8 | my( @directories )= split( m|[\\/]|, "${directories}dummy" ) ; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 8 | $directories[ $#directories ]= '' ; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 8 | return @directories ; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | =item catpath | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | Takes volume, directory and file portions and returns an entire path. Under | ||||||||||||||||||||||||||||||||||||||||||
| 285 | Unix, $volume is ignored, and this is just like catfile(). On other OSs, | ||||||||||||||||||||||||||||||||||||||||||
| 286 | the $volume become significant. | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 59 | ▶ | sub catpath { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catpath: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 59 | my ($self,$volume,$directory,$file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | # If it's UNC, make sure the glue separator is there, reusing | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # whatever separator is first in the $volume | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 59 | my $v; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 59 | ▶ | $volume .= $v | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
($v) = $volume =~ m[^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)]s and $directory =~ m[^[^\\/]]s
MC/DC0%0/2
($v) = $volume =~ m[^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)]s and $directory =~ m[^[^\\/]]s
($v) = $volume =~ m[^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)]s
$directory =~ m[^[^\\/]]s
Truth table66%2/3
A and B
A= ($v) = $volume =~ m[^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)]sB= $directory =~ m[^[^\\/]]s
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | if ( (($v) = $volume =~ m@^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)@s) && | ||||||||||||||||||||||||||||||||||||||||||
| 298 | $directory =~ m@^[^\\/]@s | ||||||||||||||||||||||||||||||||||||||||||
| 299 | ) ; | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 59 | $volume .= $directory ; | |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # If the volume is not just A:, make sure the glue separator is | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # there, reusing whatever separator is first in the $volume if possible. | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 59 | ▶ | if ( $volume !~ m@^[a-zA-Z]:\Z(?!\n)@s && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $volume =~ /^[a-zA-Z]:\Z(?!\n)/s and $volume =~ m[[^\\/]\Z(?!\n)] and $file =~ m[[^\\/]]
not $volume =~ /^[a-zA-Z]:\Z(?!\n)/s and $volume =~ m[[^\\/]\Z(?!\n)]
MC/DC66%2/3
not $volume =~ /^[a-zA-Z]:\Z(?!\n)/s and $volume =~ m[[^\\/]\Z(?!\n)] and $file =~ m[[^\\/]]
not $volume =~ /^[a-zA-Z]:\Z(?!\n)/s
$volume =~ m[[^\\/]\Z(?!\n)]
$file =~ m[[^\\/]]
Truth table75%3/4
not(A) and B and C
A= not $volume =~ /^[a-zA-Z]:\Z(?!\n)/sB= $volume =~ m[[^\\/]\Z(?!\n)]C= $file =~ m[[^\\/]]
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | $volume =~ m@[^\\/]\Z(?!\n)@ && | ||||||||||||||||||||||||||||||||||||||||||
| 307 | $file =~ m@[^\\/]@ | ||||||||||||||||||||||||||||||||||||||||||
| 308 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | $volume =~ m@([\\/])@ ; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | ▶ | my $sep = $1 ? $1 : '\\' ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 2 | $volume .= $sep ; | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 59 | $volume .= $file ; | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 59 | return $volume ; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 51 | ▶ | sub _same { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_same: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 51 | lc($_[1]) eq lc($_[2]); | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 81 | ▶ | sub rel2abs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rel2abs: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 81 | my ($self,$path,$base ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 81 | my $is_abs = $self->file_name_is_absolute($path); | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | # Check for volume (should probably document the '2' thing...) | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 81 | ▶ | return $self->canonpath( $path ) if $is_abs == 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 47 | ▶ | if ($is_abs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | # It's missing a volume, add one | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 33 | my $vol = ($self->splitpath( Cwd::getcwd() ))[0]; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 33 | return $self->canonpath( $vol . $path ); | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 14 | ▶ | if ( !defined( $base ) || $base eq '' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not defined $base or $base eq ""
MC/DC50%1/2
not defined $base or $base eq ""
not defined $base
$base eq ""
Truth table66%2/3
not(A) or B
A= not defined $baseB= $base eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 5 | ▶ | $base = Cwd::getdcwd( ($self->splitpath( $path ))[0] ) if defined &Cwd::getdcwd ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 5 | ▶ | $base = Cwd::getcwd() unless defined $base ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | elsif ( ! $self->file_name_is_absolute( $base ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $base = $self->rel2abs( $base ) ; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 9 | $base = $self->canonpath( $base ) ; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 14 | my ( $path_directories, $path_file ) = | |||||||||||||||||||||||||||||||||||||||||
| 349 | ($self->splitpath( $path, 1 ))[1,2] ; | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 14 | my ( $base_volume, $base_directories ) = | |||||||||||||||||||||||||||||||||||||||||
| 352 | $self->splitpath( $base, 1 ) ; | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 14 | $path = $self->catpath( | |||||||||||||||||||||||||||||||||||||||||
| 355 | $base_volume, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | $self->catdir( $base_directories, $path_directories ), | ||||||||||||||||||||||||||||||||||||||||||
| 357 | $path_file | ||||||||||||||||||||||||||||||||||||||||||
| 358 | ) ; | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 14 | return $self->canonpath( $path ) ; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | =head2 Note For File::Spec::Win32 Maintainers | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | Novell NetWare inherits its File::Spec behaviour from File::Spec::Win32. | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | Copyright (c) 2004,2007 by the Perl 5 Porters. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 374 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | See L<File::Spec> and L<File::Spec::Unix>. This package overrides the | ||||||||||||||||||||||||||||||||||||||||||
| 379 | implementation of these methods, not the semantics. | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | sub _canon_cat # @path -> path | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 268 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_canon_cat: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 268 | my ($first, @rest) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 268 | ▶ | my $volume = $first =~ s{ \A ([A-Za-z]:) ([\\/]?) }{}x # drive letter | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | ? ucfirst( $1 ).( $2 ? "\\" : "" ) | ||||||||||||||||||||||||||||||||||||||||||
| 390 | : $first =~ s{ \A (?:\\\\|//) ([^\\/]+) | ||||||||||||||||||||||||||||||||||||||||||
| 391 | (?: [\\/] ([^\\/]+) )? | ||||||||||||||||||||||||||||||||||||||||||
| 392 | [\\/]? }{}xs # UNC volume | ||||||||||||||||||||||||||||||||||||||||||
| 393 | ? "\\\\$1".( defined $2 ? "\\$2" : "" )."\\" | ||||||||||||||||||||||||||||||||||||||||||
| 394 | : $first =~ s{ \A [\\/] }{}x # root dir | ||||||||||||||||||||||||||||||||||||||||||
| 395 | ? "\\" | ||||||||||||||||||||||||||||||||||||||||||
| 396 | : ""; | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 268 | my $path = join "\\", $first, @rest; | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 268 | $path =~ tr#\\/#\\\\#s; # xx/yy --> xx\yy & xx\\yy --> xx\yy | |||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | # xx/././yy --> xx/yy | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 268 | $path =~ s{(?: | |||||||||||||||||||||||||||||||||||||||||
| 403 | (?:\A|\\) # at begin or after a slash | ||||||||||||||||||||||||||||||||||||||||||
| 404 | \. | ||||||||||||||||||||||||||||||||||||||||||
| 405 | (?:\\\.)* # and more | ||||||||||||||||||||||||||||||||||||||||||
| 406 | (?:\\|\z) # at end or followed by slash | ||||||||||||||||||||||||||||||||||||||||||
| 407 | )+ # performance boost -- I do not know why | ||||||||||||||||||||||||||||||||||||||||||
| 408 | }{\\}gx; | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | # XXX I do not know whether more dots are supported by the OS supporting | ||||||||||||||||||||||||||||||||||||||||||
| 411 | # this ... annotation (NetWare or symbian but not MSWin32). | ||||||||||||||||||||||||||||||||||||||||||
| 412 | # Then .... could easily become ../../.. etc: | ||||||||||||||||||||||||||||||||||||||||||
| 413 | # Replace \.\.\. by (\.\.\.+) and substitute with | ||||||||||||||||||||||||||||||||||||||||||
| 414 | # { $1 . ".." . "\\.." x (length($2)-2) }gex | ||||||||||||||||||||||||||||||||||||||||||
| 415 | # ... --> ../.. | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 268 | $path =~ s{ (\A|\\) # at begin or after a slash | |||||||||||||||||||||||||||||||||||||||||
| 417 | \.\.\. | ||||||||||||||||||||||||||||||||||||||||||
| 418 | (?=\\|\z) # at end or followed by slash | ||||||||||||||||||||||||||||||||||||||||||
| 419 | }{$1..\\..}gx; | ||||||||||||||||||||||||||||||||||||||||||
| 420 | # xx\yy\..\zz --> xx\zz | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 268 | ▶ | while ( $path =~ s{(?: | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | (?:\A|\\) # at begin or after a slash | ||||||||||||||||||||||||||||||||||||||||||
| 423 | [^\\]+ # rip this 'yy' off | ||||||||||||||||||||||||||||||||||||||||||
| 424 | \\\.\. | ||||||||||||||||||||||||||||||||||||||||||
| 425 | (?<!\A\.\.\\\.\.) # do *not* replace ^..\.. | ||||||||||||||||||||||||||||||||||||||||||
| 426 | (?<!\\\.\.\\\.\.) # do *not* replace \..\.. | ||||||||||||||||||||||||||||||||||||||||||
| 427 | (?:\\|\z) # at end or followed by slash | ||||||||||||||||||||||||||||||||||||||||||
| 428 | )+ # performance boost -- I do not know why | ||||||||||||||||||||||||||||||||||||||||||
| 429 | }{\\}sx ) {} | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 268 | $path =~ s#\A\\##; # \xx --> xx NOTE: this is *not* root | |||||||||||||||||||||||||||||||||||||||||
| 432 | 268 | $path =~ s#\\\z##; # xx\ --> xx | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 268 | ▶ | if ( $volume =~ m#\\\z# ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | { # <vol>\.. --> <vol>\ | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 214 | $path =~ s{ \A # at begin | |||||||||||||||||||||||||||||||||||||||||
| 437 | \.\. | ||||||||||||||||||||||||||||||||||||||||||
| 438 | (?:\\\.\.)* # and more | ||||||||||||||||||||||||||||||||||||||||||
| 439 | (?:\\|\z) # at end or followed by slash | ||||||||||||||||||||||||||||||||||||||||||
| 440 | }{}x; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 214 | ▶ | return $1 # \\HOST\SHARE\ --> \\HOST\SHARE | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$path eq "" and $volume =~ /\A(\\\\.*)\\\z/s
MC/DC100%2/2
$path eq "" and $volume =~ /\A(\\\\.*)\\\z/s
$path eq ""
$volume =~ /\A(\\\\.*)\\\z/s
Truth table100%3/3
A and B
A= $path eq ""B= $volume =~ /\A(\\\\.*)\\\z/s
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | if $path eq "" | ||||||||||||||||||||||||||||||||||||||||||
| 444 | and $volume =~ m#\A(\\\\.*)\\\z#s; | ||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 261 | ▶ | return $path ne "" || $volume ? $volume.$path : "."; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$path ne "" or $volume
MC/DC0%0/2
$path ne "" or $volume
$path ne ""
$volume
Truth table66%2/3
A or B
A= $path ne ""B= $volume
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||