GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-535c39c9fc
home.c File Reference

GIS Library - Get user's home or config directory. More...

#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "gis_local_proto.h"
Include dependency graph for home.c:

Go to the source code of this file.

Functions

const char * G_home (void)
 Get user's home directory. More...
 
const char * G__home (void)
 Get user's home directory (internal use only) More...
 
const char * G_config_path (void)
 Get user's config path directory. More...
 

Detailed Description

GIS Library - Get user's home or config directory.

(C) 2001-2014 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL

Definition in file home.c.

Function Documentation

◆ G__home()

const char* G__home ( void  )

Get user's home directory (internal use only)

Returns a pointer to a string which is the full path name of the user's home directory.

Returns
pointer to string
NULL on error

Definition at line 53 of file home.c.

Referenced by G_home(), and G_init_all().

◆ G_config_path()

const char* G_config_path ( void  )

Get user's config path directory.

Returns a pointer to a string which is the full path name of the user's GRASS config directory in their home directory.

The path is not guaranteed to exist.

Todo:
should it be? see possible TODO below
Returns
pointer to string
NULL on error

Definition at line 98 of file home.c.

References _, CONFIG_DIR, G_fatal_error(), G_home(), G_initialize_done(), G_is_initialized(), G_mkdir(), G_store(), GPATH_MAX, and HOST_DIRSEP.

◆ G_home()

const char* G_home ( void  )

Get user's home directory.

Returns a pointer to a string which is the full path name of the user's home directory.

Calls G_fatal_error() on failure.

Returns
pointer to string
NULL on error

Definition at line 32 of file home.c.

References _, G__home(), G_fatal_error(), and NULL.

Referenced by G_config_path().