Code review comment: Actually, if I am pushing it even when I didn't create then I am getting the `file` twice.  Something like this :  ![image](https://user-images.githubusercontent.com/46818757/107904030-b9d9a180-6f70-11eb-8ea4-926afd32b97c.png)  When I push only inside `if` i.e only when I am creating it then it works fine :) @fromage

Code under review:
private void collectKnownPaths(Path resource, StaticResourceInfo staticResourceInfo) {

        try {
            Files.walkFileTree(resource, new SimpleFileVisitor<Path>() {
                final Stack<StaticResourceInfo.StaticFile> currentFolder = new Stack<>();

                @Override
                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {

                    Path relativeFile = resource.relativize(dir);
                    String relativeFileString = "/" + relativeFile.toString();
                    Path dirName = dir.getFileName();
                    StaticResourceInfo.StaticFile getStaticFile = staticResourceInfo.resourceMap.get(relativeFileString);

                    if (getStaticFile == null) {
                        getStaticFile = new StaticResourceInfo.StaticFile(dirName.toString(), true);
                        staticResourceInfo.resourceMap.put(relativeFileString, getStaticFile);

                        
                        if (!currentFolder.isEmpty()) {
                            currentFolder.peek().children.add(getStaticFile);
                        }
                        currentFolder.push(getStaticFile);
                    }
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    String fileName = file.getFileName().toString();

                    StaticResourceInfo.StaticFile newStaticFile = new StaticResourceInfo.StaticFile(fileName, false);

                    if (!currentFolder.empty() && !currentFolder.peek().children.contains(newStaticFile)) {
                        List<StaticResourceInfo.StaticFile> childrenList = currentFolder.peek().children;
                        childrenList.add(newStaticFile);
                    }
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
                    if (!currentFolder.empty()) {
                        currentFolder.pop();
                    }
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

Line commented on: currentFolder.push(getStaticFile);

Revised code:
private void collectKnownPaths(Path resource, StaticResourceInfo staticResourceInfo) {

        try {
            Files.walkFileTree(resource, new SimpleFileVisitor<Path>() {
                final Stack<StaticResourceInfo.StaticFile> currentFolder = new Stack<>();

                @Override
                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {

                    Path relativeFile = resource.relativize(dir);
                    String relativeFileString = "/" + relativeFile.toString();
                    Path dirName = dir.getFileName();
                    StaticResourceInfo.StaticFile getStaticFile = staticResourceInfo.resourceMap.get(relativeFileString);
                    if (getStaticFile == null) {
                        getStaticFile = new StaticResourceInfo.StaticFile(dirName.toString(), true);
                        staticResourceInfo.resourceMap.put(relativeFileString, getStaticFile);

                        
                        if (!currentFolder.isEmpty()) {
                            currentFolder.peek().children.add(getStaticFile);
                        }
                    }
                    currentFolder.push(getStaticFile);
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    String fileName = file.getFileName().toString();
                    StaticResourceInfo.StaticFile newStaticFile = new StaticResourceInfo.StaticFile(fileName, false);

                    List<StaticResourceInfo.StaticFile> childrenList = currentFolder.peek().children;
                    childrenList.add(newStaticFile);

                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
                    Collections.sort(currentFolder.peek().children);
                    currentFolder.pop();
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }