FileDocCategorySizeDatePackage
FileSystem.javaAPI DocApache Ant 1.702023Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.types.resources.comparators

FileSystem

public class FileSystem extends ResourceComparator
Compares filesystem Resources.
since
Ant 1.7

Fields Summary
private static final org.apache.tools.ant.util.FileUtils
FILE_UTILS
Constructors Summary
Methods Summary
protected intresourceCompare(org.apache.tools.ant.types.Resource foo, org.apache.tools.ant.types.Resource bar)
Compare two Resources.

param
foo the first Resource.
param
bar the second Resource.
return
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
throws
ClassCastException if either resource is not an instance of FileResource.


                                                                
          
        File foofile = ((FileResource) foo).getFile();
        File barfile = ((FileResource) bar).getFile();
        return foofile.equals(barfile) ? 0
            : FILE_UTILS.isLeadingPath(foofile, barfile) ? -1
            : FILE_UTILS.normalize(foofile.getAbsolutePath()).compareTo(
                FILE_UTILS.normalize(barfile.getAbsolutePath()));