private void addFolderToZip(ZipPath path, File source, ZipOutputStream zip, boolean excludeRootDir) throws IOException { ZipPath newPath = path.with(source); if (source.isFile()) { addToZip(newPath, source, zip, false); } else { addDirectory(path, source, zip, excludeRootDir); } }