[GRASS-dev] Re: gis.m: font selection in module panels
Glynn Clements
glynn at gclements.plus.com
Sun May 20 23:50:02 EDT 2007
Michael Barton wrote:
> It seems like the issue is that this method to check to see if a variable
> has been set won't work under windows.
>
> if {[info exists VAR]} { do something }
>
> Maybe if I wrap it in a catch statement...? Anyone have a suggestion about
> this.
In general, it's safer to just try something and catch any errors
which occur than to attempt to predict errors.
FWIW, I would change:
if {[info exists env(GRASS_FONT)] && $env(GRASS_FONT) != ""} {
...
}
to:
catch {
if {$env(GRASS_FONT) != ""} {
...
}
}
BTW, I did find this (dtext.tcl:338):
if {$currfont == "" && [info exists env(GRASS_FONT]} {
Note the missing closing parenthesis.
Also, it looks as if someone has been editing the code with 4-column
tab stops, so the formatting is screwed up. Again: if you want to use
4-column tabs in your own code, fine, but don't do it in GRASS.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list