[GRASS-dev] possible etc file finder function

Glynn Clements glynn at gclements.plus.com
Mon Apr 2 22:37:16 EDT 2007


William Kyngesburye wrote:

> Per my note about accessing user addon modules outside the GRASS  
> application installation, such as in their home folder, I made an  
> attempt at a function to locate a file in configured etc locations.
> 
> I'm not much of a C programmer, and really I just modified a copy of  
> find_file.c.  Tear it apart and give it to me straight ^_^
> 
> The 3 possible etc folder locations it will look are:
> 
> 1: the user's home folder
> 2: a globa/system folder
> 3: the GRASS application folder (or, the current default)
> 
> It needs a couple configured vars to set the user and global  
> folders.  I put these in in a new etc.h.  The user dir is relative to  
> HOME and the global should be an absolute dir.  ie, for OSX:
> 
> #define ETC_PATH_USER "Library/GRASS/6.3/Modules/etc"
> #define ETC_PATH_GLOBAL "/Library/GRASS/6.3/Modules/etc"
> 
> Existing, builtin, modules don't need to be changed to use this.   
> It's really only necessary for external modules that have support  
> data files.  v.in.dwg would be an example, if that was built and  
> installed outside the GRASS application (and that is probably  
> necessary for binary distributions).

I don't think that what you are trying do is practical. Add-on modules
should just go into $GISBASE.

However, if you want to make a module look elsewhere for its data
files, use an environment variable rather than a compile-time setting.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list