Skip to content

Commit

Permalink
Update asset loading
Browse files Browse the repository at this point in the history
Asset namespaces are now searched at `/<namespace>/` instead of `/assets/<namespace>/`
  • Loading branch information
StartsMercury committed Jan 7, 2025
1 parent 10d5438 commit df51674
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ public static void findAll(
final Path root,
final BiConsumer<? super Identifier, ? super Path> action
) {
final var rootAssets = root.normalize().resolve("assets");
final var rootAssets = root.normalize();

try (final var namespacedPaths = Files.list(rootAssets)) {
namespacedPaths.forEach((final var namespacedPath) -> {
final var namespace = rootAssets.relativize(namespacedPath).toString();
namespacedPaths
.filter(Files::isDirectory)
.forEach((final var namespacedPath) -> {
final var namespace = rootAssets.relativize(namespacedPath).toString();

AssetFinder.findNamespaced(
namespace,
namespacedPath,
prefix,
extension,
action
);
});
AssetFinder.findNamespaced(
namespace,
namespacedPath,
prefix,
extension,
action
);
});
} catch (final NoSuchFileException | NotDirectoryException ignored) {

} catch (final IOException cause) {
Expand Down Expand Up @@ -98,8 +100,16 @@ public void scan(final Path root) {
this.extension,
this.action
);
// AssetFinder.findNamespaced(
// this.namespace,
// root.resolve("assets").resolve(this.namespace),
// this.prefix,
// this.extension,
// this.action
// );
} else {
AssetFinder.findAll(this.prefix, this.extension, root, this.action);
// AssetFinder.findAll(this.prefix, this.extension, root.resolve("assets"), this.action);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"testmod:alpha": "Test Block Alpha"
}

0 comments on commit df51674

Please sign in to comment.