[GRASS-dev] select issue with wingrass
Glynn Clements
glynn at gclements.plus.com
Mon Nov 19 11:16:36 EST 2007
Moritz Lennert wrote:
> > Have you tried "file normalize"? If that works, it's preferable to
> > spawning g.dirseps.
>
> I actually did try it (thought I had written that, but I guess it was
> too late for my brain). I don't think file normalize is what we need.
> Apparently, when confronted with a path name it doesn't recognize it
> "normalizes" it by appending it to the path of pwd:
>
> so
>
> C:\>tclsh
> % file normalize c:\grassdata
> C:/GRASSDATA
>
> but
>
> C:\TEST>tclsh
> % file normalize c:\grassdata
This isn't a valid test. The backslash is significant to Tcl. In the
above, "\g" is parsed as "g" by Tcl, so it's equivalent to:
file normalize c:grassdata
As the path doesn't begin with "\" or "/", "file normalize" interprets
it as relative to the current directory of C: (on Windows, each drive
has its own current directory).
A correct test is:
file normalize {c:\grassdata}
> c:/TEST/grassdata
> % file normalize c:/grassdata
> C:/GRASSDATA
>
> This might explain why the select window works with
> GISDBASE=c:\grassdata when pwd is c:\.
Nope.
> BTW, I think I have found the culprit for having c:\grassdata in the
> .grassrc6 file: it seems to be the text mode startup. It does not
> transform c:\grassdata into c:/grassdata before writing .grassrc6 as
> does the tcltk startup.
>
> Could this be the problem (I don't really understand what it does in
> detail). It's from lib/init/set_data.c (line 125ff):
>
> #ifdef __MINGW32__
> if (*gisdbase == '/')
> {
> char tmp[200], *p;
> sprintf(tmp, "%s", getenv("WD"));
> for(p=tmp+strlen(tmp); --p>=tmp && *p=='\\';);
> for(; --p>=tmp && *p!='\\';);
> for(; --p>=tmp && *p=='\\';);
> *(p+1) = 0;
> for(p=tmp; *p; p++)
> if(*p == '\\')
> *p = '/';
> strcat(tmp, gisdbase);
> strcpy(gisdbase, tmp);
> }
> if (!gisdbase[1] || gisdbase[1] != ':')
> #else
Right; it needs to call G_convert_dirseps_from_host().
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list