[GRASS5] [bug #2381] (grass) g.mapsets: limit mapset list to valid entries

this bug's URL: http://intevation.de/rt/webrt?serial_num=2381
-------------------------------------------------------------------------

Subject: g.mapsets: limit mapset list to valid entries

Platform: GNU/Linux/i386
grass obtained from: Mirror of Trento site
grass binary for platform: Compiled from Sources
GRASS Version: 5.3 cvs apr 2004

'g.mapsets -l' and the Tcl/Tk startup GUI list all directories & files as possible locations and mapsets. This should be limited to real & existing mapsets.

some bash script examples on how this might be done,
($1 = mapset name to be tested)

basic check if mapset directory exists:
if [ -d "`g.gisenv get=GISDBASE`"/"`g.gisenv get=LOCATION_NAME`"/"$1" ] ; then

better check if region file exists in tested mapset:
if [ -e "`g.gisenv get=GISDBASE`"/"`g.gisenv get=LOCATION_NAME`"/"$1"/WIND ] ; then

right now g.mapsets uses a system("ls ..."); command to generate the list, I suppose the tcl/tk menu uses something like exec["ls ..."] but I haven't checked.
Will any of the library functions work for this purpose (for g.mapsets at least)? If not should there be one?

see also bug # 1797
http://intevation.de/rt/webrt?serial_num=1797

?
Hamish

-------------------------------------------- Managed by Request Tracker