Prevent duplicate files from getting onto sources

This commit is contained in:
Dave Syer
2014-04-30 17:33:23 +01:00
parent 7a33afa722
commit 12ede8689a
2 changed files with 22 additions and 2 deletions

View File

@@ -115,7 +115,7 @@ public abstract class ResourceUtils {
continue;
}
}
result.add(resource.getURL().toExternalForm());
result.add(absolutePath(resource));
}
}
return result;
@@ -127,12 +127,19 @@ public abstract class ResourceUtils {
List<String> childFiles = new ArrayList<String>();
for (Resource child : children) {
if (!child.getFile().isDirectory()) {
childFiles.add(child.getURL().toExternalForm());
childFiles.add(absolutePath(child));
}
}
return childFiles;
}
private static String absolutePath(Resource resource) throws IOException {
if (!resource.getURI().getScheme().equals("file")) {
return resource.getURL().toExternalForm();
}
return resource.getFile().getAbsoluteFile().toURI().toString();
}
private static String stripLeadingSlashes(String path) {
while (path.startsWith("/")) {
path = path.substring(1);