g.filename: Create dir in mapset only when asked #1687
Merged
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.
The previous behavior is creating the corresponding directory in the current
mapset anytime the module is executed (the intention was anytime the path is
in the current mapset according to the doc).
Creating the directory makes sense given the intended use of the module
(notably, the module is used only in one v6 addon as of now).
Given that there is a distinction between creation of an element and file
(even when file is a directory), having the functionality in a module
allows for treating the element case in a special way (see #1681).
However, given the primary function of this module (constructing a path regardless of
its existence), writing operation is unexpected, so the new default is not writing
anything and creation needs to be explicitly requested using a new -c flag
which causes fatal error when the constructed path is not in the current mapset
(asking for creation of something outside of the current mapset is considered a usage error).