Perform the conversion
int count = 0;
// Step through each file and convert.
Iterator iter = filesets.iterator();
while( iter.hasNext() ) {
FileSet fs = (FileSet)iter.next();
DirectoryScanner ds = fs.getDirectoryScanner( project );
File basedir = ds.getBasedir();
String[] files = ds.getIncludedFiles();
for( int i = 0; i < files.length; i++ ) {
File from = new File( basedir, files[i] );
File to = new File( todir, files[i] + ".html" );
if( !to.exists() ||
(from.lastModified() > to.lastModified()) )
{
log( "Converting file '" + from.getAbsolutePath() +
"' to '" + to.getAbsolutePath(), Project.MSG_VERBOSE );
try {
convert( from, to );
}
catch( IOException e ) {
throw new BuildException( "Could not convert '" +
from.getAbsolutePath() + "' to '" +
to.getAbsolutePath() + "'", e );
}
count++;
}
}
if( count > 0 ) {
log( "Converted " + count + " file" + (count > 1 ? "s" : "") +
" to " + todir.getAbsolutePath() );
}
}