GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
file_name.c File Reference

GIS library - Determine GRASS data base file name. More...

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

Go to the source code of this file.

Functions

char * G_file_name (char *path, const char *element, const char *name, const char *mapset)
 Builds full path names to GIS data files. More...
 
char * G_file_name_misc (char *path, const char *dir, const char *element, const char *name, const char *mapset)
 Builds full path names to GIS misc data files. More...
 
char * G_file_name_tmp (char *path, const char *element, const char *name, const char *mapset)
 Builds full path names to GIS data files in temporary directory (for internal use only) More...
 

Detailed Description

GIS library - Determine GRASS data base file name.

(C) 2001-2015 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 file_name.c.

Function Documentation

◆ G_file_name()

char* G_file_name ( char *  path,
const char *  element,
const char *  name,
const char *  mapset 
)

Builds full path names to GIS data files.

If name is of the form "nnn@ppp" then path is set as if name had been "nnn" and mapset had been "ppp" (mapset parameter itself is ignored in this case).

Parameters
[out]pathbuffer to hold resultant full path to file
elementdatabase element (eg, "cell", "cellhd", "vector", etc)
namename of file to build path to (fully qualified names allowed)
mapsetmapset name
Returns
pointer to path buffer

Definition at line 38 of file file_name.c.

Referenced by G_get_projepsg(), G_get_projinfo(), G_get_projunits(), G_has_vector_timestamp(), G_make_mapset_element(), G_mapset_permissions(), G_myname(), G_rename(), G_write_projsrid(), G_write_projwkt(), list_subgroups(), M__empty(), M_do_copy(), main(), Rast_map_is_fp(), Rast_map_type(), V1_close_nat(), Vect__get_element_path(), and Vect_copy().

◆ G_file_name_misc()

char* G_file_name_misc ( char *  path,
const char *  dir,
const char *  element,
const char *  name,
const char *  mapset 
)

Builds full path names to GIS misc data files.

Parameters
[out]pathbuffer to hold resultant full path to file
dirmisc directory
elementdatabase element (eg, "cell", "cellhd", "vector", etc)
namename of file to build path to (fully qualified names allowed)
mapsetmapset name
Returns
pointer to path buffer

Definition at line 55 of file file_name.c.

Referenced by Rast3d_filename(), Rast__check_fp_type(), and Rast__close_null().

◆ G_file_name_tmp()

char* G_file_name_tmp ( char *  path,
const char *  element,
const char *  name,
const char *  mapset 
)

Builds full path names to GIS data files in temporary directory (for internal use only)

By default temporary directory is located $LOCATION/$MAPSET/.tmp/$HOSTNAME. If GRASS_VECTOR_TMPDIR_MAPSET is set to "0", the temporary directory is located in TMPDIR (environmental variable defined by the user or GRASS initialization script if not given). Note that GRASS_VECTOR_TMPDIR_MAPSET variable is currently used only by vector library.

Parameters
[out]pathbuffer to hold resultant full path to file
elementdatabase element (eg, "cell", "cellhd", "vector", etc)
namename of file to build path to (fully qualified names allowed)
mapsetmapset name
Returns
pointer to path buffer

Definition at line 80 of file file_name.c.

References getenv(), and NULL.

Referenced by G_make_mapset_element_tmp(), and Vect__get_element_path().