GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
gisbase.c File Reference
#include <grass/gis.h>
Include dependency graph for gisbase.c:

Go to the source code of this file.

Functions

const char * G_gisbase (void)
 Get full path name of the top level module directory. More...
 

Function Documentation

◆ G_gisbase()

const char* G_gisbase ( void  )

Get full path name of the top level module directory.

Returns the full path name of the top level directory for GRASS programs. This directory will have subdirectories which will contain modules and files required for the running of the system. Some of these directories are:

bin    commands run by the user
etc    modules and data files used by GRASS commands

The use of G_gisbase() to find these subdirectories enables GRASS modules to be written independently of where the GRASS system is actually installed on the machine. For example, to run the module sroff in the GRASS etc directory:

char command[200];
sprintf(command, "%s/etc/sroff", G_gisbase());
G_spawn(command, "sroff", NULL);
Returns
pointer to a string

Definition at line 41 of file gisbase.c.

References G_getenv().

Referenced by GPJ_osr_to_grass(), GPJ_set_csv_loc(), and parse_fontcap().