[GRASS-dev] simplify G_convert_dirseps_to_host(G_tempfile()) ?

Paul Kelly paul-grass at stjohnspoint.co.uk
Mon Jun 18 05:20:20 EDT 2007


On Mon, 18 Jun 2007, Hamish wrote:

> [r.average]
>
> should G_tempfile() be calling G_convert_dirseps_to_host() internally,
> rather than having individual modules calling it? (ie often forgetting
> to call it)

I don't think so - G_convert_dirseps_to_host() only needs to be called 
in certain situations, when the generated path will be used directly by 
external commands on the system. I think to unconditionally call it would 
confuse its purpose. But then again in the longrun it might be a good idea 
to generally simplify things as you said. Hmm, I'm not so sure now. But 
there may be cases which call it and expect to have '/' directory 
separators there for some further processing; I wouldn't like to just 
change it without an audit of where it is used. Which modules were you 
thinking of anyway?

FWIW I've attached my proposed changes to lib/gis/tempfile.c that I still 
have in my local source tree. They were intended to split the usage of 
G_tempfile() between modules that are genuinely using it as a tempfile for 
creating large temporary maps as was originally intended, and those that 
are just using it as a general small tempfile function. They also make 
some changes to make it more Windows compatible. But we decided they were 
too controversial to commit in case they broke things - maybe in some way 
we can eventually merge them though.

Paul




More information about the grass-dev mailing list