take of relative path in configuration file

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1400162 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-19 16:48:56 +00:00
parent b85e828155
commit f34d32f93c
1 changed files with 17 additions and 4 deletions

View File

@ -556,6 +556,22 @@ public class DefaultManagedRepositoryAdmin
public IndexingContext createIndexContext( ManagedRepository repository ) public IndexingContext createIndexContext( ManagedRepository repository )
throws RepositoryAdminException throws RepositoryAdminException
{ {
// take care first about repository location as can be relative
File repositoryDirectory = new File( repository.getLocation() );
if ( !repositoryDirectory.isAbsolute() )
{
repositoryDirectory =
new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
repository.getLocation() );
}
if ( !repositoryDirectory.exists() )
{
repositoryDirectory.mkdirs();
}
try try
{ {
@ -585,10 +601,7 @@ public class DefaultManagedRepositoryAdmin
indexDirectory = new File( managedRepository, ".indexer" ); indexDirectory = new File( managedRepository, ".indexer" );
if ( !managedRepository.isAbsolute() ) if ( !managedRepository.isAbsolute() )
{ {
indexDirectory = new File( indexDirectory = new File( repositoryDirectory, ".indexer" );
getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories"
+ File.separatorChar +
repository.getLocation(), ".indexer" );
repository.setIndexDirectory( indexDirectory.getAbsolutePath() ); repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
} }
} }