--- projects/cms/source/server/uk/org/iscream/cms/server/client/WebFeeder.java 2001/03/16 16:47:33 1.15 +++ projects/cms/source/server/uk/org/iscream/cms/server/client/WebFeeder.java 2001/03/19 21:30:30 1.16 @@ -15,7 +15,7 @@ import java.io.*; * !! that to a file. * * @author $Author: tdb $ - * @version $Id: WebFeeder.java,v 1.15 2001/03/16 16:47:33 tdb Exp $ + * @version $Id: WebFeeder.java,v 1.16 2001/03/19 21:30:30 tdb Exp $ */ public class WebFeeder extends Thread { @@ -24,7 +24,7 @@ public class WebFeeder extends Thread { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.15 $"; + public static final String REVISION = "$Revision: 1.16 $"; /** * Default check period in seconds (30 minutes) @@ -170,7 +170,18 @@ public class WebFeeder extends Thread { long age = System.currentTimeMillis() - lastModified; if(age > ((long) deleteOlderThan*1000)) { // it's also older than our age to delete older than - if(!alertFile.delete()) { + if(alertFile.delete()) { + // do a quick check to see if the directory is now empty + File[] newHostdirContents = hostdir.listFiles(); + if(newHostdirContents.length == 0) { + // it does seem to be, try and delete it + // this will fail anyway if files still remain + if(!hostdir.delete()) { + _logger.write(this.toString(), Logger.WARNING, "Failed to delete the following empty host directory: "+hostdir.getPath()); + } + } + } + else { _logger.write(this.toString(), Logger.WARNING, "Failed to delete the following 'old' alert file: "+alertFile.getPath()); } }