1 package File::Spec::Win32;
5 File::Spec::Win32 - methods for Win32 file specs
9 use File::Spec::Win32; # Done internally by File::Spec if needed
13 See File::Spec::Unix for a documentation of the methods provided
14 there. This package overrides the implementation of these methods, not
30 Exporter::import('File::Spec', qw( $Verbose));
32 @ISA = qw(File::Spec::Unix);
34 $ENV{EMXSHELL} = 'sh'; # to run `commands`
36 sub file_name_is_absolute {
38 $file =~ m{^([a-z]:)?[\\/]}i ;
45 # append a slash to each argument unless it has one there
46 $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
48 my $result = $self->canonpath(join('', @args));
54 Concatenate one or more directory names and a filename to form a
55 complete path ending with a filename
62 return $file unless @_;
63 my $dir = $self->catdir(@_);
65 $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\";
76 my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
77 my @path = split(';',$path);
78 foreach(@path) { $_ = '.' if $_ eq '' }
84 No physical check on the filesystem, but a logical cleanup of a
85 path. On UNIX eliminated successive slashes and successive "/.".
91 $path =~ s/^([a-z]:)/\u$1/;
93 $path =~ s|\\+|\\|g ; # xx////xx -> xx/xx
94 $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
95 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
97 unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
98 $path .= '.' if $path =~ m#\\$#;