Skip to content

Commit

Permalink
Fix trying to write inside non-existent directories
Browse files Browse the repository at this point in the history
Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
  • Loading branch information
TheSilkMiner committed May 21, 2022
1 parent 7e4a377 commit f2cd356
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ String fsId() {
private void provide(final String path, final byte... resource) {
try {
final Path target = this.fs().getPath(path).toAbsolutePath().normalize();
final Path parent = target.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
if (Files.exists(target)) {
throw new IllegalArgumentException("A resource for path " + path + " has already been provided for fragment " + this.key());
}
Expand Down

0 comments on commit f2cd356

Please sign in to comment.