Skip to content

Commit

Permalink
Check that the assets directory exists before retrieving its content (#…
Browse files Browse the repository at this point in the history
…13)

Signed-off-by: Clement Escoffier <[email protected]>
  • Loading branch information
cescoffier committed Jul 2, 2014
1 parent a9d15bb commit ca67671
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,19 @@ private Asset<File> getAssetFromFS(String path) {
@Override
public Collection<Asset<?>> assets() {
HashMap<String, Asset<?>> map = new HashMap<>();
// First insert the FS assets
// For this iterate over the file present on the file system.
Collection<File> files = FileUtils.listFiles(directory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
for (File file : files) {
if (file.getName().startsWith(".")) {
// Skip file starting with .
continue;
if (directory.isDirectory()) {
// First insert the FS assets
// For this iterate over the file present on the file system.
Collection<File> files = FileUtils.listFiles(directory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
for (File file : files) {
if (file.getName().startsWith(".")) {
// Skip file starting with .
continue;
}
String path = "/assets" + file.getAbsolutePath().substring(directory.getAbsolutePath().length());
// TODO Do we really need computing the ETAG here ?
map.put(path, new DefaultAsset<>(path, file, file.getAbsolutePath(), file.lastModified(), null));
}
String path = "/assets" + file.getAbsolutePath().substring(directory.getAbsolutePath().length());
// TODO Do we really need computing the ETAG here ?
map.put(path, new DefaultAsset<>(path, file, file.getAbsolutePath(), file.lastModified(), null));
}

// No add the bundle things.
Expand Down

0 comments on commit ca67671

Please sign in to comment.