[MNG-4305] [regression] ${localRepository.basedir} is not a proper path

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@805061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-17 17:30:33 +00:00
parent 00ed1a01c0
commit b725e30dea
3 changed files with 23 additions and 1 deletions

View File

@ -267,6 +267,9 @@ public class MavenArtifactRepository
{
retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
}
// normalize separators
retValue = new File( retValue ).getPath();
}
if ( retValue == null )

View File

@ -1,5 +1,6 @@
package org.apache.maven.repository;
import java.io.File;
import java.util.Arrays;
import java.util.List;
@ -186,7 +187,7 @@ public class MirrorProcessorTest
ArtifactRepository repo = repos.get( 0 );
assertEquals( "file:///tmp", repo.getUrl() );
assertEquals( "file", repo.getProtocol() );
assertEquals( "/tmp", repo.getBasedir() );
assertEquals( File.separator + "tmp", repo.getBasedir() );
}
/**

View File

@ -135,4 +135,22 @@ public class LegacyRepositorySystemTest
assertTrue( result.hasMissingArtifacts() );
}
}
public void testLocalRepositoryBasedir()
throws Exception
{
File localRepoDir = new File( "" ).getAbsoluteFile();
ArtifactRepository localRepo = repositorySystem.createLocalRepository( localRepoDir );
String basedir = localRepo.getBasedir();
assertFalse( basedir.endsWith( "/" ) );
assertFalse( basedir.endsWith( "\\" ) );
assertEquals( localRepoDir, new File( basedir ) );
assertEquals( localRepoDir.getPath(), basedir );
}
}