GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
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);
#define NULL
Definition: ccmath.h:32
const char * G_gisbase(void)
Get full path name of the top level module directory.
Definition: gisbase.c:39
int G_spawn(const char *command,...)
Spawn new process based on command.
Definition: spawn.c:919
Returns
pointer to a string

Definition at line 39 of file gisbase.c.

References G_getenv().

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