[GRASS-dev] possible etc file finder function

William Kyngesburye woklist at kyngchaos.com
Mon Apr 2 16:30:12 EDT 2007

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).

-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

"Mon Dieu! but they are all alike.  Cheating, murdering, lying,  
fighting, and all for things that the beasts of the jungle would not  
deign to possess - money to purchase the effeminate pleasures of  
weaklings.  And yet withal bound down by silly customs that make them  
slaves to their unhappy lot while firm in the belief that they be the  
lords of creation enjoying the only real pleasures of existence....

- the wisdom of Tarzan

More information about the grass-dev mailing list