[GRASS-dev] select issue with wingrass

Glynn Clements glynn at gclements.plus.com
Mon Nov 19 11:04:28 EST 2007


Michael Barton 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 ?
> > 
> > Have you tried "file normalize"? If that works, it's preferable to
> > spawning g.dirseps.
> 
> Is "file normalize" a TclTk thing or a Windows thing?

Tcl. From the file(n) manpage:

       file normalize name
              Returns  a  unique  normalized path representation for the file-
              system object (file, directory, link, etc), whose  string  value
              can be used as a unique identifier for it.  A normalized path is
              an absolute path which has all '../', './' removed.  Also it  is
              one which is in the ``standard'' format for the native platform.
              On MacOS, Unix, this means the segments leading up to  the  path
              must  be  free of symbolic links/aliases (but the very last path
              component may be a symbolic link), and on Windows it also  means
              we  want  the  long form with that form's case-dependence (which
              gives us a unique, case-dependent path).  The one exception con-
              cerning  the  last link in the path is necessary, because Tcl or
              the user may wish to operate on the actual symbolic link  itself
              (for  example  'file  delete',  'file  rename',  'file copy' are
              defined to operate on symbolic links, not  on  the  things  that
              they point to).

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


More information about the grass-dev mailing list