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.writeStr(name);
ctx.writeStr(switch (t) {
.err => "\",\"read_error\":true",
.other_fs => "\",\"excluded\":\"othfs\"",
.kernfs => "\",\"excluded\":\"kernfs\"",
.excluded => "\",\"excluded\":\"pattern\"",
ctx.write(switch (t) {
.err => "\",\"read_error\":true}",
.other_fs => "\",\"excluded\":\"othfs\"}",
.kernfs => "\",\"excluded\":\"kernfs\"}",
.excluded => "\",\"excluded\":\"pattern\"}",
});
if (isdir) ctx.writeByte(']');
}