private void downloadDirectory()

in src/main/java/com/google/devtools/build/remote/client/AbstractRemoteActionCache.java [111:139]


  private void downloadDirectory(Path path, Directory dir, Map<Digest, Directory> childrenMap)
      throws IOException {
    // Ensure that the directory is created here even though the directory might be empty
    Files.createDirectories(path);
    for (FileNode child : dir.getFilesList()) {
      Path childPath = path.resolve(child.getName());
      try {
        downloadFile(childPath, child.getDigest(), child.getIsExecutable(), null);
      } catch (IOException e) {
        throw new IOException(String.format("Failed to download file %s", child.getName()), e);
      }
    }
    for (DirectoryNode child : dir.getDirectoriesList()) {
      Path childPath = path.resolve(child.getName());
      Digest childDigest = child.getDigest();
      Directory childDir = childrenMap.get(childDigest);
      if (childDir == null) {
        throw new IOException(
            "could not find subdirectory "
                + child.getName()
                + " of directory "
                + path
                + " for download: digest "
                + childDigest
                + "not found");
      }
      downloadDirectory(childPath, childDir, childrenMap);
    }
  }