relativeToRoot static method

String relativeToRoot(
  1. String filePath,
  2. String rootPath
)

Converts an absolute file path to one relative to rootPath, with forward slashes regardless of host OS — matching how paths are referenced in Dart source, ignore/baseline config, and JSON/SARIF output.

Implementation

static String relativeToRoot(String filePath, String rootPath) {
  return p.relative(filePath, from: rootPath).replaceAll(r'\', '/');
}