@Override
    protected void runFile(Path file) {
        try (BundleReader bundleReader = new BundleReader(file)) {
            Bundle bundle = bundleReader.read();

            AtomicInteger done = new AtomicInteger();
            long total = bundle.entryInfos().size();

            // define output directory, if not yet defined
            if (outputDir == null) {
                // if there's only one file inside the bundle, then don't bother
                // with sub-directories
                if (bundle.entryInfos().size() == 1) {
                    outputDir = file.getParent();
                    if (outputDir == null) {
                        // Passed a filename only. Use the current directory.
                        outputDir = Paths.get(".");
                    }
                } else {
                    String fileName = PathUtils.getBaseName(file);
                    outputDir = file.resolveSibling(fileName);
                }
            }

            try {
                bundle.entries()
                    .stream()
                    .filter(entry -> filename == null || entry.name().equals(filename))
                    .forEach(uncheck(entry -> {
                        progress.update(Optional.of(entry.name()), done.getAndIncrement() / (double) total);
                        Path entryFile = outputDir.resolve(entry.name());

                        Files.createDirectories(entryFile.getParent());
                        Files.copy(entry.inputStream(), entryFile, REPLACE_EXISTING);

                        if (done.get() == total) {
                            progress.update(Optional.empty(), 1);
                        }
                }));
            } catch (UncheckedIOException ex) {
                throw ex.getCause();
            }

            if (writeProp && filename == null) {
                String bundleName = outputDir.getFileName().toString();
                Path propsFile = outputDir.getParent().resolve(bundleName + ".json");
                BundleProps.write(propsFile, bundle);
            }
        } catch (IOException ex) {
            L.log(Level.WARNING, "Can't unpack asset bundle " + file, ex);
        }
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-cli/src/main/java/info/ata4/disunity/cli/command/bundle/BundleUnpack.java