|
|
@@ -38,8 +38,18 @@ public class FileSystem extends ResourceComparator { |
|
|
|
* @throws ClassCastException if either resource is not an instance of FileResource. |
|
|
|
*/ |
|
|
|
protected int resourceCompare(Resource foo, Resource bar) { |
|
|
|
File foofile = ((FileProvider) foo.as(FileProvider.class)).getFile(); |
|
|
|
File barfile = ((FileProvider) bar.as(FileProvider.class)).getFile(); |
|
|
|
FileProvider fooFP = (FileProvider) foo.as(FileProvider.class); |
|
|
|
if (fooFP == null) { |
|
|
|
throw new ClassCastException(foo.getClass() |
|
|
|
+ " doesn't provide files"); |
|
|
|
} |
|
|
|
File foofile = fooFP.getFile(); |
|
|
|
FileProvider barFP = (FileProvider) bar.as(FileProvider.class); |
|
|
|
if (barFP == null) { |
|
|
|
throw new ClassCastException(bar.getClass() |
|
|
|
+ " doesn't provide files"); |
|
|
|
} |
|
|
|
File barfile = barFP.getFile(); |
|
|
|
return foofile.equals(barfile) ? 0 |
|
|
|
: FILE_UTILS.isLeadingPath(foofile, barfile) ? -1 |
|
|
|
: FILE_UTILS.normalize(foofile.getAbsolutePath()).compareTo( |
|
|
|