From fa66bd3c4215dd711d81946fbefc997988e825d1 Mon Sep 17 00:00:00 2001 From: dfsek Date: Tue, 7 Jun 2022 08:32:55 -0700 Subject: [PATCH] create addon dir if it doesn't exist --- .../terra/addon/BootstrapAddonLoader.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/common/implementation/bootstrap-addon-loader/src/main/java/com/dfsek/terra/addon/BootstrapAddonLoader.java b/common/implementation/bootstrap-addon-loader/src/main/java/com/dfsek/terra/addon/BootstrapAddonLoader.java index f3b56cde7..e6027fe88 100644 --- a/common/implementation/bootstrap-addon-loader/src/main/java/com/dfsek/terra/addon/BootstrapAddonLoader.java +++ b/common/implementation/bootstrap-addon-loader/src/main/java/com/dfsek/terra/addon/BootstrapAddonLoader.java @@ -80,15 +80,18 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon> loadAddons(Path addonsFolder, BootstrapAddonClassLoader parent) { - Path bootstrapFolder = addonsFolder.resolve("bootstrap"); - logger.debug("Loading bootstrap addons from {}", bootstrapFolder); - - try(Stream bootstrapAddons = Files.walk(bootstrapFolder, 1, FileVisitOption.FOLLOW_LINKS)) { - return bootstrapAddons.filter(path -> path.toFile().isFile()) - .filter(path -> path.toFile().canRead()) - .filter(path -> path.toString().endsWith(".jar")) - .map(path -> loadAddon(path, parent)) - .collect(Collectors.toList()); + try { + Path bootstrapFolder = addonsFolder.resolve("bootstrap"); + Files.createDirectories(bootstrapFolder); + logger.debug("Loading bootstrap addons from {}", bootstrapFolder); + + try(Stream bootstrapAddons = Files.walk(bootstrapFolder, 1, FileVisitOption.FOLLOW_LINKS)) { + return bootstrapAddons.filter(path -> path.toFile().isFile()) + .filter(path -> path.toFile().canRead()) + .filter(path -> path.toString().endsWith(".jar")) + .map(path -> loadAddon(path, parent)) + .collect(Collectors.toList()); + } } catch(IOException e) { throw new UncheckedIOException(e); }