Fix JSON export of special entries

This commit is contained in:
Yorhel 2024-07-24 07:34:12 +02:00
parent 2b2b4473e5
commit dc42c91619

View file

@ -168,11 +168,11 @@ const JsonWriter = struct {
}; };
ctx.write(if (isdir) ",\n[{\"name\":\"" else ",\n{\"name\":\""); ctx.write(if (isdir) ",\n[{\"name\":\"" else ",\n{\"name\":\"");
ctx.writeStr(name); ctx.writeStr(name);
ctx.writeStr(switch (t) { ctx.write(switch (t) {
.err => "\",\"read_error\":true", .err => "\",\"read_error\":true}",
.other_fs => "\",\"excluded\":\"othfs\"", .other_fs => "\",\"excluded\":\"othfs\"}",
.kernfs => "\",\"excluded\":\"kernfs\"", .kernfs => "\",\"excluded\":\"kernfs\"}",
.excluded => "\",\"excluded\":\"pattern\"", .excluded => "\",\"excluded\":\"pattern\"}",
}); });
if (isdir) ctx.writeByte(']'); if (isdir) ctx.writeByte(']');
} }