private void ftpChangeDirectory( Resource resource )
throws IOException, TransferFailedException, ResourceDoesNotExistException
{
if ( !ftp.changeWorkingDirectory( getRepository().getBasedir() ) )
{
throw new ResourceDoesNotExistException(
"Required directory: '" + getRepository().getBasedir() + "' " + "is missing" );
}
String[] dirs = PathUtils.dirnames( resource.getName() );
for ( int i = 0; i < dirs.length; i++ )
{
boolean dirChanged = ftp.changeWorkingDirectory( dirs[i] );
if ( !dirChanged )
{
String msg = "Resource " + resource + " not found. Directory " + dirs[i] + " does not exist";
throw new ResourceDoesNotExistException( msg );
}
}
}