[GRASS5] WAS: r.terraflow - NOW: G_tempfile()

Brad Douglas rez at touchofmadness.com
Sat Jun 25 04:02:58 EDT 2005


On Sat, 2005-06-25 at 17:04 +1200, Hamish wrote:
> > While I'm at it, should I create 'char *G_mktemp(int global)' and 'int
> > G_rmtemp(char *path)' functions?
> 
> You don't need to create that dir, GRASS does that automatically on
> startup and removes it on exit. You just have to point to it.

The above functions wouldn't create the dir, but the temp file within.
Essentially "macro" functions to save a few lines of code here and there
and provides a wrapper for G_tempfile() and G_local_tempfile().
Completely optional, but I think it's a good idea...especially for the
average module programmer who does not [need to] intimately know the
GRASS API.

It is a large change, but will not affect existing modules as the old
functions will still be exported, but I would recommend depreciating
them in the next major release and eventually removing them.

> in the shell:
> GRASS_TMPDIR="`dirname $GISRC`/"
>
> Slight problem where it doesn't get cleaned up if you start from the GUI
> and hit "Exit" from the startup screen or make a new location by EPSG
> number. Perhaps it shouldn't make the dir until after you select a
> mapset?
> 
> (setup & teardown of tmp dir are in lib/init/init.sh)

/tmp should not be referenced directly -- it is not portable.  It should
be setup from the environment.  Why is that commented out in init.sh?

When I wrote the original email, I was looking at _get_make_sock_path().
I had not ventured into the shell scripts.  Thank you for the insight.

Having the dir already setup by init.sh does greatly simplify things for
me, although _get_make_sock_path() needs fixing.


-- 
Brad Douglas <rez at touchofmadness.com>




More information about the grass-dev mailing list