isDuplicatePath function

bool isDuplicatePath(
  1. FsOperations fs,
  2. String filePath,
  3. Set<String> loadedPaths
)

Check if a file path is a duplicate and should be skipped. Resolves symlinks to detect duplicates pointing to the same file. If not a duplicate, adds the resolved path to loadedPaths.

Returns true if the file should be skipped (is duplicate).

Implementation

bool isDuplicatePath(
  FsOperations fs,
  String filePath,
  Set<String> loadedPaths,
) {
  final result = safeResolvePath(fs, filePath);
  if (loadedPaths.contains(result.resolvedPath)) {
    return true;
  }
  loadedPaths.add(result.resolvedPath);
  return false;
}