findRepoRoot function

String findRepoRoot([
  1. String? start
])

Repository root, located by walking up to the Objective-C fixtures.

Implementation

String findRepoRoot([String? start]) {
  var dir = Directory(start ?? Directory.current.path).absolute;
  while (true) {
    if (File(fixtureHeader(dir.path)).existsSync()) return dir.path;
    final parent = dir.parent;
    if (parent.path == dir.path) {
      throw StateError(
        'Repository root not found from ${start ?? Directory.current.path}',
      );
    }
    dir = parent;
  }
}