1 package File::Spec::Win32;
5 require File::Spec::Unix;
6 @ISA = qw(File::Spec::Unix);
10 File::Spec::Win32 - methods for Win32 file specs
14 require File::Spec::Win32; # Done internally by File::Spec if needed
18 See File::Spec::Unix for a documentation of the methods provided
19 there. This package overrides the implementation of these methods, not
26 Returns a string representation of the null device.
36 Returns a string representation of the first existing directory
37 from the following list:
49 return $tmpdir if defined $tmpdir;
51 foreach (@ENV{qw(TMPDIR TEMP TMP)}, qw(/tmp /)) {
52 next unless defined && -d;
56 $tmpdir = '' unless defined $tmpdir;
57 $tmpdir = $self->canonpath($tmpdir);
61 sub file_name_is_absolute {
62 my ($self,$file) = @_;
63 return scalar($file =~ m{^([a-z]:)?[\\/]}i);
68 Concatenate one or more directory names and a filename to form a
69 complete path ending with a filename
76 return $file unless @_;
77 my $dir = $self->catdir(@_);
78 $dir .= "\\" unless substr($dir,-1) eq "\\";
84 my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
85 my @path = split(';',$path);
86 foreach (@path) { $_ = '.' if $_ eq '' }
92 No physical check on the filesystem, but a logical cleanup of a
93 path. On UNIX eliminated successive slashes and successive "/.".
98 my ($self,$path) = @_;
99 $path =~ s/^([a-z]:)/\u$1/;
101 $path =~ s|([^\\])\\+|\1\\|g; # xx////xx -> xx/xx
102 $path =~ s|(\\\.)+\\|\\|g; # xx/././xx -> xx/xx
103 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
105 unless $path =~ m#^([A-Z]:)?\\#; # xx/ -> xx