Skip to content

Commit

Permalink
Fix JSON output for xcode-locator
Browse files Browse the repository at this point in the history
Fixes bazelbuild#13067

The last comma makes the output invalid JSON.

Closes bazelbuild#13068.

PiperOrigin-RevId: 359080239
  • Loading branch information
goodspark authored and copybara-github committed Feb 23, 2021
1 parent 56119f7 commit 1bae172
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/osx/xcode_locator.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ static void DumpAsJson(
FILE *output,
NSMutableDictionary<NSString *, XcodeVersionEntry *> *dict) {
fprintf(output, "{\n");
int i = 0;
for (NSString *version in dict) {
XcodeVersionEntry *entry = dict[version];
fprintf(output, "\t\"%s\": \"%s\",\n",
version.UTF8String, entry.url.fileSystemRepresentation);
fprintf(output, "\t\"%s\": \"%s\"%s\n",
version.UTF8String, entry.url.fileSystemRepresentation,
++i == [dict count] ? "" : ",");
}
fprintf(output, "}\n");
}
Expand Down

0 comments on commit 1bae172

Please sign in to comment.