[ "Unix->canonpath('')", '' ],
[ "Unix->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ],
-[ "Unix->canonpath('/.')", '/.' ],
+[ "Unix->canonpath('/.')", '/' ],
+[ "Unix->canonpath('/./')", '/' ],
+[ "Unix->canonpath('/a/./')", '/a' ],
+[ "Unix->canonpath('/a/.')", '/a' ],
[ "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')", '' ],
[ "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ],
#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ],
[ "Unix->abs2rel('/','/t1/t2/t3')", '../../..' ],
[ "Unix->abs2rel('///','/t1/t2/t3')", '../../..' ],
-[ "Unix->abs2rel('/.','/t1/t2/t3')", '../../../.' ],
+[ "Unix->abs2rel('/.','/t1/t2/t3')", '../../..' ],
[ "Unix->abs2rel('/./','/t1/t2/t3')", '../../..' ],
#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ],
=item canonpath
No physical check on the filesystem, but a logical cleanup of a
-path. On UNIX eliminated successive slashes and successive "/.".
+path. On UNIX eliminate successive slashes and successive "/.".
$cpath = File::Spec->canonpath( $path ) ;
$node = $1;
}
$path =~ s|/+|/|g unless($^O eq 'cygwin'); # xx////xx -> xx/xx
- $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx
+ $path =~ s@(/\.)+(/|\Z(?!\n))@/@g; # xx/././xx -> xx/xx
$path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx
$path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx
$path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx