[GRASS-dev] i.rectify should test for illegal file names before launching rectification

Glynn Clements glynn at gclements.plus.com
Tue Nov 6 05:08:27 EST 2007


Moritz Lennert wrote:

> >> >> If you give an illegal output name to i.rectify, this is only tested
> >> >> after rectification. This should be done before in order to have to
> >> wait
> >> >> for the whole process to finish to then notice it won't work.
> >> >>
> >> > Right - I guess
> >> >  G_legal_filename()
> >> > at the beginning would do the job.
> >>
> >> Yes, just make sure to check the given output filename + the given
> >> extension.
> > 
> > Oh; you're talking about illegal *file* names (as opposed to map
> > names)?
> 
> No sorry, I meant map names.

Oops; I saw "extension" and assumed filenames.

> So what would be the tcltk gui equivalent of extension= or extension="" 
> ?

The Tcl equivalent is just:

	extension=

> "Extension" is a text field to be filled in. So as a result you get a 
> command line with extension=anything you put in the field (without any 
> quotes. However, leaving the field empty does not work, as it is a 
> required field. '""' doesn't work either. Would it work if the gui used 
> curly braces around the result ? I.e. how to indicate an empty string to 
> the gui ?

This appears to be a deficiency with the way that the GUI decides
whether to pass an option.

G_parser() can distinguish between an absent option and an option with
the empty string as its value.

If the GUI treats an empty text field as the option not being given,
then there is no way to pass an empty string as an option value. 
Anything you put into the text field will be passed literally as the
option's value.

AFAICT, the only solution is to add a checkbox to each option to force
the option to be passed. I suspect that i.rectify won't be the only
module where you might want to pass the empty string as an option
value.

Note that we have a similar problem with scripts using g.parser. I.e. 
there's no way to distinguish between an absent option and the empty
string as the option's value.

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




More information about the grass-dev mailing list