Conversation
Both -G (gmtwhich) and -D (gmtget) already detect a missing file after gmt_download_file_if_not_found() (the not-found message, and the error lines it logs) but discarded that outcome and always returned GMT_NOERROR. Track it instead and return GMT_FILE_NOT_FOUND when a requested download did not produce the file. Scoped to -G/-D only (a plain "gmt which localfile" is unaffected) and gmtwhich -C keeps exiting 0, since its whole point is reporting Y/N as text. Tiled dataset listings are not covered here. Fixes #9195 Assisted-by: Claude Sonnet 5
The tiled-dataset branch needs its own JP2-vs-netCDF existence check (a tile that -N leaves as JP2 is still present), which duplicates logic gmt_set_remote_and_local_filenames() already gets right internally. Rather than reimplementing it, leave tiled datasets unchecked here, same as gmt which -G already does. For the two remaining checks, use a fixed offset of 1 instead of the return value of gmt_download_file_if_not_found(): every file name here is built locally as "@%s", so the offset is always 1. Assisted-by: Claude Sonnet 5, reviewed by Claude Opus 5
joa-quim
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gmt which -Gandgmt get -Dnow exit with the error code fromsrc/gmt_error_codes.h(GMT_FILE_NOT_FOUND= 16) when a requested download didn't produce the file, instead of always exiting 0.Tested with:
Fixes #9195
Assisted-by: Claude Sonnet 5, reviewed by Claude Opus 5