[GRASS-dev] select issue with wingrass

Moritz Lennert mlennert at club.worldonline.be
Sun Nov 18 18:04:27 EST 2007


Glynn Clements wrote:
> Moritz Lennert wrote:
> 
>> select.tcl uses both the GISDBASE and MAPSET env variables. However,
>> neither seem to be defined in wingrass (Init.sh sets them, but Init.bat
>> doesn't).
> 
> Init.sh sets them as shell variables; they aren't exported to the
> environment.
> 
>> So I tried the following:
>>
>> - enter GRASS
>> - set GISDBASE=c:\GRASSDATA
>> - run in tclsh
>> % set location_path "$env(GISDBASE)/$env(LOCATION_NAME)/'
>> % set dir "user1"
>> % set element "vector"
>> % set path "$location_path/$dir/$element/
>> % glob -nocomplain $path/*
>>
>> This returns nothing.
>> When I set GISDBASE=c:/GRASSDATA (forward slash), it returns the list of
>> complete paths to all elements.
> 
> [I missed this part before.]
> 
> That makes sense. Tcl uses forward slash internally on all platforms. 
> It suspect that it requires the use of "file normalize ..." on
> Windows.
> 

I can confirm that this seems to be the problem: I had a .grassrc6 file 
with c:\grassdata in it. When I change this to c:/grassdata, the select 
window works from any working dir. By default (i.e. when there is no 
.grassrc6), grass writes the new file in the correct format 
(c:/grassdata). Don't know how I ended up with c:\grassdata...maybe I 
wrote it manually.

Michael and Javi can you confirm ?

Glynn Clements wrote:
 > Ah; the reason it's been working so far is that both lib/gis/gui.tcl
 > and gui/tcltk/gis.m/gm.tcl set them, e.g.:
 >
 > if {[catch {set env(GISDBASE) [exec g.gisenv get=GISDBASE]} error]} {
 >
 > Any other code which uses select.tcl will need to do likewise.
 >
 > Use of env() is less than ideal (there's already enough confusion
 > between GRASS variables and environment variables), but using separate
 > variables would require changing a lot of "global" statements.

Changing above line to

if {[catch {set env(GISDBASE) [exec g.dirseps -g [exec g.gisenv 
get=GISDBASE]]} error]} {

in lib/gis/gui.tcl seems to work for me. Can I commit ?

Should I also change this in gui/tcltk/gis.m/gm.tcl ?


Moritz


More information about the grass-dev mailing list