setRoots method

void setRoots(
  1. Iterable<String> folderPaths
)

Create context from a set of folders.

The folder paths does not neccessarily be normalized.

Implementation

void setRoots(Iterable<String> folderPaths) {
  final roots = folderPaths
      // .map((folderPath) => HTResourceContext.getAbsolutePath(key: folderPath))
      .toSet();
  roots.removeWhere((root1) {
    for (final root2 in roots) {
      if (root2 == root1) continue;
      if (path.isWithin(root2, root1)) {
        return true;
      }
    }
    return false;
  });
  _contextRoots.clear();
  for (final root in roots) {
    final context = createContext(root);
    _contextRoots[root] = context;
  }
  if (onRootsUpdated != null) {
    onRootsUpdated!();
  }
}