# Canonicalize. If build directory ends up the same as source directory, drop it
if (defined $this->{builddir}) {
- $this->{builddir} = $this->_canonpath($this->{builddir});
+ $this->{builddir} = $this->canonpath($this->{builddir});
if ($this->{builddir} eq $this->get_sourcedir()) {
$this->{builddir} = undef;
}
# Enhanced version of File::Spec::canonpath. It collapses ..
# too so it may return invalid path if symlinks are involved.
# On the other hand, it does not need for the path to exist.
-sub _canonpath {
+sub canonpath {
my ($this, $path)=@_;
my @canon;
my $back=0;
}
### Test Buildsystem class API methods
-is( $BS_CLASS->_canonpath("path/to/the/./nowhere/../../somewhere"),
- "path/to/somewhere", "_canonpath no1" );
-is( $BS_CLASS->_canonpath("path/to/../forward/../../somewhere"),
- "somewhere","_canonpath no2" );
-is( $BS_CLASS->_canonpath("path/to/../../../somewhere"),
- "../somewhere","_canonpath no3" );
-is( $BS_CLASS->_canonpath("./"), ".", "_canonpath no4" );
+is( $BS_CLASS->canonpath("path/to/the/./nowhere/../../somewhere"),
+ "path/to/somewhere", "canonpath no1" );
+is( $BS_CLASS->canonpath("path/to/../forward/../../somewhere"),
+ "somewhere","canonpath no2" );
+is( $BS_CLASS->canonpath("path/to/../../../somewhere"),
+ "../somewhere","canonpath no3" );
+is( $BS_CLASS->canonpath("./"), ".", "canonpath no4" );
is( $BS_CLASS->_rel2rel("path/my/file", "path/my"),
"file", "_rel2rel no1" );
is( $BS_CLASS->_rel2rel("path/dir/file", "path/my"),