Tools: Set key 'file' for grib_ls

This commit is contained in:
shahramn 2024-09-09 21:00:46 +01:00
parent 40747f8703
commit 15685f9922
1 changed files with 6 additions and 4 deletions

View File

@ -371,10 +371,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
}
if (!json_latlon && options->json_output) {
if (options->current_infile && 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");
}
@ -383,6 +379,12 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
first_handle = 0;
}
}
if (options->current_infile && options->current_infile->name) {
size = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &size);
}
new_handle = "\n,";
return 0;
}