[GRASS-dev] illegal characters in filenames

Hi there,

while programming a grass module I would like to open some raster input files.

Doing it the way as it's done in the r.example I get the following messages,
(which I'd like to avoid):
----------------------------------------------------------------------------------------
Illegal filename. character </> not allowed.

GRASS_INFO_WARNING(5821,1): unable to find
[/home/andi/uni/da/prog/grassdb/metapop_test/PERMANENT/.tmp/hobbes/5821.0] in
[PERMANENT]
Illegal filename. character </> not allowed.

GRASS_INFO_WARNING(5821,2): unable to find
[/home/andi/uni/da/prog/grassdb/metapop_test/PERMANENT/.tmp/hobbes/5821.1] in
[PERMANENT]
Illegal filename. character </> not allowed.
----------------------------------------------------------------------------------------

When i open one of the raster files before in the grass-UI, I get the message
the "@" in metapop_test_rastersomething@PERMANENT is a prohibited character.

Is there a standard method (non-documented, or
not-to-be-found-elsewhere-in-the-grass-documents, by the way) of avoiding
these messages and getting grass to do what's supposed to do?

Thanks for the help!

Andi

--
Andreas Gros (PhD-Student)
Fieldstation Fabrikschleichach
University Wuerzburg
Glashuettenstr. 5
96181 Rauhenebrach
Tel.: +49 931 888 3079
Fax.: +49 931 888 3089

Andreas Gros wrote:

while programming a grass module I would like to open some raster input files.

Are you talking about map names or file pathnames?

Doing it the way as it's done in the r.example I get the following messages,
(which I'd like to avoid):

Illegal filename. character </> not allowed.

GRASS_INFO_WARNING(5821,1): unable to find
[/home/andi/uni/da/prog/grassdb/metapop_test/PERMANENT/.tmp/hobbes/5821.0] in
[PERMANENT]

If you are referring to file pathnames, don't pass them to
G_legal_filename(); that function is specifically for validating the
names of maps (i.e. files within the GRASS database).

When i open one of the raster files before in the grass-UI, I get the message
the "@" in metapop_test_rastersomething@PERMANENT is a prohibited character.

The argument to G_legal_filename() needs to be an unqualified map name
(i.e. with no @mapset part). It isn't legal to use the map@mapset
syntax for an output map; output maps are always created in the
current mapset.

In most cases, modules don't need to explicitly validate map names.
For input maps, the name will have been validated when the map was
created, while output maps will have the name validated by the call to
G_open_raster_new().

--
Glynn Clements <glynn@gclements.plus.com>