Subject: | catpath won't handle rootdir + path under cygwin |
Under cygwin, catdir( '/', 'my/path' ) returns '//my/path' rather than
'/my/path'.
The join in catdir assumes canonpath will deal with the multiple
slashes, but canonpath doesn't strip them becuase it interprets the path
as a network path (as it should in most cases). Adding this to Cygwin.pm
to override the Unix.pm verions of catdir fixes it:
sub catdir {
my ($self, @path) = @_;
$path[0] = '' if $path[0] eq '/'; # avoid adding // by mistake
$self->canonpath(join('/', @path, '')); # '' because need a trailing '/'
}
Actually, I would assume that this change would be appropriate under
Unix.pm, but I haven't thought through all the implications yet.
Regards,
Mark