[GRASS-dev] Windows-style Pathnames

Paul Kelly paul-grass at stjohnspoint.co.uk
Sun Nov 19 16:40:35 EST 2006


On Thu, 2 Nov 2006, Paul Kelly wrote:

[...]
> How big a problem do you think this is? I would hazard a guess that in most 
> cases Msys/Unix commands used in scripts will work OK with c:/grass/grassdata 
> style paths used throughout. How many scripts set the PATH? Are there 
> standard Msys functions or commands for converting a path between formats 
> that we could use in some way?

I've written a short module to convert directory separator characters in 
strings to and from GRASS format (always /) or native host format (\ on 
Windows). There were already some gislib functions to do this but I think 
it's going to be necessary to have it as a module to be used in startup 
scripts etc and perhaps other places. If anybody knows some other 
already-existing utility we could use to do this then that would be great, 
otherwise I'm planning on committing it as "g.dirseps" in the next few 
days. Functionality synopsis:

C:\>g.dirseps help

Description:
  Internal GRASS utility. Converts any directory separator characters in 
the input string to or from native host format, and writes the changed 
path to standard output. Useful in scripts for Windows compatibility.

Keywords:
  general

Usage:
  g.dirseps [-hg] [path=string] [--verbose] [--quiet]

Flags:
   -h   Convert directory separators to native host format
   -g   Convert directory separators to GRASS internal format
  --v   Verbose module output
  --q   Quiet module output

Parameters:
   path   Path to be converted (read from stdin if not specified)

C:\>




More information about the grass-dev mailing list