[GRASS-git] [OSGeo/grass] c0cda1: g.filename: Create dir in mapset only when asked (...

Vaclav Petras noreply at github.com
Mon Jul 12 18:50:52 PDT 2021


  Branch: refs/heads/master
  Home:   https://github.com/OSGeo/grass
  Commit: c0cda13b9e38c0e32f139537eaba8a2a5b6c6888
      https://github.com/OSGeo/grass/commit/c0cda13b9e38c0e32f139537eaba8a2a5b6c6888
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2021-07-12 (Mon, 12 Jul 2021)

  Changed paths:
    M general/g.filename/g.filename.html
    M general/g.filename/main.c

  Log Message:
  -----------
  g.filename: Create dir in mapset only when asked (#1687)

The previous behavior is creating the corresponding directory in the current
mapset anytime the module is executed (the intention was only when the path is
in the current mapset according to the doc).

Creating the directory makes sense in general given the intended use of the module
(get path for a file in mapset, possibly in order to create it).
Given that there is a distinction between creation of an element (dir) and file
(even when file is a directory), having the functionality in a module
allows for treating the element case in a special way (not implemented yet, but see #1681).
However, notably, the module is used only in one v6 addon as of now.

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).




More information about the grass-commit mailing list