ECC-1073: grib_ls/bufr_ls with the JSON option: Set key 'file'

This commit is contained in:
Shahram Najm 2020-02-13 18:09:04 +00:00
parent aea5aa5fa3
commit b11cdf670f
2 changed files with 8 additions and 0 deletions

View File

@ -105,6 +105,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
exit(err);
}
if (options->json_output) {
if (options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}
if (!first_handle && options->handle_count > 1) {
fprintf(stdout, ",\n");
}

View File

@ -360,6 +360,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
}
if (!json_latlon && options->json_output) {
if (options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}
if (!first_handle && options->handle_count > 1) {
fprintf(stdout, ",\n");
}