[GRASS-dev] [bug #5220] (grass) wingrass: v.in.ogr (tcltk version) creates wrong directory path

Glynn Clements glynn at gclements.plus.com
Thu Oct 19 14:21:54 EDT 2006

Request Tracker wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=5220
> -------------------------------------------------------------------------
> Subject: wingrass: v.in.ogr (tcltk version) creates wrong directory path
> Platform: WindowsNT/2000/XP
> grass obtained from: Other (CDROM etc)
> grass binary for platform: Downloaded precompiled Binaries
> GRASS Version: huidae's wingrass version sept. 17c
> Directory paths created by the tcktk dialogs (navigate to find file
> buttons) do not work in wingrass. They are created in the form
> c:/moritz, but in order for them to be recognized, they should be in
> the form /c/moritz.

That depends upon the Tcl/Tk implementation. For a native Windows
Tcl/Tk implementation, you would have to use c:\moritz. The /c/moritz
syntax is part of MinGW/Cygwin; it isn't valid within Windows itself.

Michael Barton wrote:

> The tcltk file browser is a prebuilt widget. The Windows version apparently
> returns files in proper Windows format. If all file parsing for windows
> platforms should switch from c:/ to /c/, this could be parsed in an if
> clause to test for windows platform. Is this kind of reparsing needed
> universally for windows or just in some places? It would take some effort to
> track down and change in the appropriate places (most importantly in
> gui.tcl), but it is doable.

Probably the safest solution is to use Tcl's "file" command to manage
filenames, rather than trying to do it manually using string
operations. The following sub-commands appear relevant.

       file dirname name
       file extension name
       file join name ?name ...?
       file nativename name
       file normalize name
       file pathtype name
       file rootname name
       file separator ?name?
       file split name
       file tail name
       file volumes


1. While most Windows API calls accept both '\' and '/', most
console-mode commands only accept '\', as '/' is used for switches
(which needn't be preceded by a space; "dir foo/w" is equivalent to
"dir foo /w" or "dir /w foo"). You probably need to use
"file nativename" for any filenames passed to Tcl's "exec" command.

2. Don't forget about UNC paths: \\server\share\path\to\file.txt

3. There is some additional information in the filename(n) manpage.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list