GRASS 8 Programmer's Manual 8.6.0dev(2026)-afb4ae8f9e
Loading...
Searching...
No Matches
resource_dirs.c
Go to the documentation of this file.
1/*!
2 \file lib/gis/resource_dirs.c
3
4 \brief GIS Library - Get paths to resource directories.
5
6 \author Nicklas Larsson
7
8 (c) 2025 by the GRASS Development Team
9
10 SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#include <stdlib.h>
14
15#include <grass/gis.h>
16#include <grass/glocale.h>
17
18static const char *get_g_env(const char *);
19
20const char *G_colors_dir(void)
21{
22 return get_g_env("GRASS_COLORSDIR");
23}
24
25const char *G_etcbin_dir(void)
26{
27 return get_g_env("GRASS_ETCBINDIR");
28}
29
30const char *G_etc_dir(void)
31{
32 return get_g_env("GRASS_ETCDIR");
33}
34
35const char *G_fonts_dir(void)
36{
37 return get_g_env("GRASS_FONTSDIR");
38}
39
40const char *G_locale_dir(void)
41{
42 return get_g_env("GRASS_LOCALEDIR");
43}
44
45static const char *get_g_env(const char *env_var)
46{
47 const char *value = getenv(env_var);
48 if (value)
49 return value;
50
51 G_fatal_error(_("Incomplete GRASS session: Variable '%s' not set"),
52 env_var);
53}
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define _(str)
Definition glocale.h:10
const char * G_locale_dir(void)
const char * G_fonts_dir(void)
const char * G_colors_dir(void)
const char * G_etcbin_dir(void)
const char * G_etc_dir(void)