[GRASS-dev] Windows-style Pathnames

Paul Kelly paul-grass at stjohnspoint.co.uk
Thu Nov 2 14:52:08 EST 2006

On Wed, 1 Nov 2006, Glynn Clements wrote:

> For the above case, there should probably be a
> G_is_directory_separator() function which determines whether or not
> its argument is a directory separator on the host platform.

OK, I'm looking at this now. So on Windows that function would return true 
for both '\\' and '/' being passed to it, and on Unix only for '/'?

> There also needs to be a macro (e.g. DIRSEP) which expands to the
> preferred separator. While Windows accepts both / and \ in a lot of
> situations, there are some (notably command lines) where only \ works.

Yes. Although when constructing a command line, often part of the path is 
already constructed for you (e.g. the output of G_gisbase() ). So I think 
perhaps a function that took a string as an argument and made sure all the 
directory separators in it were the preferred ones for that host, might be 
useful. I'll look at doing that.

More information about the grass-dev mailing list