fn findRoot(d: *Diagnostics, kind: FileKind, path: []const u8) !void d: *Diagnosticskind: FileKindpath: []const u856
57
58
59
60
61
62
63
64
65
66
67
68
69 fn findRoot(d: *Diagnostics, kind: FileKind, path: []const u8) !void {
if (path.len == 0) return;
d.entries += 1;
const root_dir = rootDir(path, kind);
if (d.entries == 1) {
d.root_dir = try d.allocator.dupe(u8, root_dir);
return;
}
if (d.root_dir.len == 0 or std.mem.eql(u8, root_dir, d.root_dir))
return;
d.allocator.free(d.root_dir);
d.root_dir = "";
}