mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
create addon dir if it doesn't exist
This commit is contained in:
@@ -80,15 +80,18 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon<BootstrapBaseAdd
|
||||
|
||||
@Override
|
||||
public Iterable<BootstrapBaseAddon<?>> loadAddons(Path addonsFolder, BootstrapAddonClassLoader parent) {
|
||||
Path bootstrapFolder = addonsFolder.resolve("bootstrap");
|
||||
logger.debug("Loading bootstrap addons from {}", bootstrapFolder);
|
||||
|
||||
try(Stream<Path> 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<Path> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user