[GRASS-dev] select issue with wingrass

Glynn Clements glynn at gclements.plus.com
Tue Nov 6 04:55:06 EST 2007


Michael Barton wrote:

> I have a postdoc who just arrived to learn a bit of GRASS in my lab today.
> He installed WinGRASS about a week ago. It launches fine. But he cannot see
> any of the map files inside the mapset when he tries to add a map to a GUI
> window. This is controlled by select.tcl. We checked this against the
> Spearfish dataset and confirmed that the data are fine and that he does have
> access to the maps. In fact, if he types in a map name, any module seems to
> run fine--including displaying a map in the GIS Manager.
> 
> When you click a button to launch select.tcl, you get a window/dialog with a
> tree which shows available mapsets and, if they exist, any accessible maps
> in the mapset. You can select a map and click OK. Everything works for Javi
> except seeing the maps inside the mapsets. He can even see the mapsets
> (first level of the tree); just not the maps inside a mapset.
> 
> A first guess on my part is something to do with translating forward slash
> for *nix and Mac "/" to backward slash for Windows "\". The odd thing is
> that this worked fine with earlier builds of WinGRASS, so maybe it's
> something else.

The relevant code is:

    # main selection subroutine
    if {$element != "symbol"} {
        foreach dir [exec g.mapsets -p] {
            set windfile "$location_path/$dir/WIND"
            if { ! [ file exists $windfile ] } { continue }
            if { $dir == $current_mapset } {
                $tree insert end root ms_$dir -text $dir -data $dir -open 1 \
                -image [Bitmap::get openfold] -drawcross auto
            } else {
                $tree insert end root ms_$dir -text $dir -data $dir -open 0 \
                -image [Bitmap::get folder] -drawcross auto
            }
            set path "$location_path/$dir/$element/"
            foreach fp [ lsort [glob -nocomplain $path/*] ]  {
            set file [file tail $fp]
            $tree insert end ms_$dir $file@$dir -text $file -data $file \
                -image [Bitmap::get file] -drawcross never
            }
        }
    }

The "file exists $windfile" test is obviously working, otherwise he
wouldn't see the mapsets. The most likely problem is with the "glob"
command. The glob(n) manpage implies that / should work. Can you try
running tclsh/wish interactively and testing the behaviour of the glob
command?

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




More information about the grass-dev mailing list