mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Fix walkFileSystems with non-root source directories
This commit is contained in:
@@ -352,19 +352,16 @@ public class MinecraftProvider extends DependencyProvider {
|
||||
private void walkFileSystems(File source, File target, Predicate<Path> filter, Function<FileSystem, Iterable<Path>> toWalk, FsPathConsumer action) throws IOException {
|
||||
try (FileSystem sourceFs = FileSystems.newFileSystem(new URI("jar:" + source.toURI()), ImmutableMap.of("create", false));
|
||||
FileSystem targetFs = FileSystems.newFileSystem(new URI("jar:" + target.toURI()), ImmutableMap.of("create", false))) {
|
||||
for (Path rootDirectory : toWalk.apply(sourceFs)) {
|
||||
java.nio.file.Files.walk(rootDirectory)
|
||||
for (Path sourceDir : toWalk.apply(sourceFs)) {
|
||||
Path dir = sourceDir.toAbsolutePath();
|
||||
java.nio.file.Files.walk(dir)
|
||||
.filter(java.nio.file.Files::isRegularFile)
|
||||
.filter(filter)
|
||||
.forEach(it -> {
|
||||
boolean actuallyRoot = rootDirectory.getParent() == null;
|
||||
|
||||
if (!actuallyRoot) {
|
||||
System.out.printf("%s relativizes %s to %s%n", rootDirectory, it, rootDirectory.relativize(it));
|
||||
}
|
||||
boolean root = dir.getParent() == null;
|
||||
|
||||
try {
|
||||
action.accept(sourceFs, targetFs, actuallyRoot ? it : rootDirectory.relativize(it));
|
||||
action.accept(sourceFs, targetFs, root ? it : dir.relativize(it));
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user