if ( actFile != null )
{
// check if the file exists, if it does then the profile will be active
String fileString = actFile.getExists();
RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
try
{
interpolator.addValueSource( new EnvarBasedValueSource() );
}
catch ( IOException e )
{
// ignored
}
interpolator.addValueSource( new MapBasedValueSource( System.getProperties() ) );
if ( StringUtils.isNotEmpty( fileString ) )
{
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
return FileUtils.fileExists( fileString );
}
// check if the file is missing, if it is then the profile will be active
fileString = actFile.getMissing();
if ( StringUtils.isNotEmpty( fileString ) )
{
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
return !FileUtils.fileExists( fileString );
}
}
return false;