Exemple #1
0
  /**
   * Recursively populates the cache.
   *
   * @param root root directory
   * @param pc file cache
   * @throws InterruptedException interruption
   */
  void add(final IOFile root, final ProjectCache pc) throws InterruptedException {
    // check if file cache was replaced or invalidated
    if (pc != cache) throw new InterruptedException();

    final IOFile[] files = root.children();
    for (final IOFile file : files) {
      if (file.name().equals(IO.IGNORESUFFIX)) return;
    }
    for (final IOFile file : files) {
      if (file.isDir()) {
        add(file, pc);
      } else {
        pc.add(file.path());
      }
    }
  }