diff --git a/src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java b/src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java index a7f0c090..b35d53e5 100644 --- a/src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java +++ b/src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java @@ -475,17 +475,14 @@ private List>> read(final Path file, boole final boolean saveData, final List fsToClose) throws IOException { List>> ret = new ArrayList<>(); - Files.walkFileTree(file, new SimpleFileVisitor() { - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - String name = file.getFileName().toString(); - - if (name.endsWith(".jar") - || name.endsWith(".zip") - || name.endsWith(".class")) { - ret.add(CompletableFuture.supplyAsync(new Supplier>() { - @Override - public List get() { + if (Files.isDirectory(file)) { + Files.walkFileTree(file, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + String name = file.getFileName().toString(); + + if (name.endsWith(".class")) { + ret.add(CompletableFuture.supplyAsync(() -> { try { return readFile(file, isInput, tags, srcPath, fsToClose); } catch (URISyntaxException e) { @@ -493,13 +490,24 @@ public List get() { } catch (IOException | ZipError e) { throw new RuntimeException("Error reading file "+file, e); } - } - }, threadPool)); + }, threadPool)); + } + + return FileVisitResult.CONTINUE; } + }); + } else { + ret.add(CompletableFuture.supplyAsync(() -> { + try { + return readFile(file, isInput, tags, srcPath, fsToClose); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } catch (IOException | ZipError e) { + throw new RuntimeException("Error reading file "+file, e); + } + })); + } - return FileVisitResult.CONTINUE; - } - }); return ret; }