GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
find_file.c File Reference

GIS library - Find GRASS data base files. More...

#include <string.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for find_file.c:

Go to the source code of this file.

Functions

const char * G_find_file (const char *element, char *name, const char *mapset)
 Searches for a file from the mapset search list or in a specified mapset. More...
 
const char * G_find_file_misc (const char *dir, const char *element, char *name, const char *mapset)
 Searches for a misc file from the mapset search list or in a specified mapset. More...
 
const char * G_find_file2 (const char *element, const char *name, const char *mapset)
 Searches for a file from the mapset search list or in a specified mapset. (look but don't touch) More...
 
const char * G_find_file2_misc (const char *dir, const char *element, const char *name, const char *mapset)
 Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch) More...
 

Detailed Description

GIS library - Find GRASS data base files.

(C) 2001-2009 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 find_file.c.

Function Documentation

◆ G_find_file()

const char* G_find_file ( const char *  element,
char *  name,
const char *  mapset 
)

Searches for a file from the mapset search list or in a specified mapset.

Returns the mapset name where the file was found.

If the user specifies a fully qualified element (name) which exists, then G_find_file() modifies "name" by removing the "@mapset" part.

Rejects all names that begin with "."

If name is of the form nnn in ppp then only mapset ppp is searched.

Parameters
elementdatabase element (eg, "cell", "cellhd", "colr", etc)
namefile name to look for
mapsetmapset to search. if mapset is "" will search in mapset search list
Returns
pointer to a string with name of mapset where file was found, or NULL if not found

Definition at line 203 of file find_file.c.

Referenced by G_find_raster(), and G_find_vector().

◆ G_find_file2()

const char* G_find_file2 ( const char *  element,
const char *  name,
const char *  mapset 
)

Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)

Returns the mapset name where the file was found.

Exactly the same as G_find_file() except that if name is in the form "<i>name@mapset</i>", and is found, G_find_file2() will not alter name by removing the "@<i>mapset</i>" part.

Rejects all names that begin with "."

Parameters
elementdatabase element (eg, "cell", "cellhd", "colr", etc)
namefile name to look for
mapsetmapset to search. if mapset is "" will search in mapset search list
Returns
pointer to a string with name of mapset where file was found, or NULL if not found

Definition at line 249 of file find_file.c.

Referenced by G_find_raster2(), G_find_vector2(), Gs_load_3dview(), I_find_group(), I_find_group2(), M_find(), V1_close_ogr(), and Vect_close().

◆ G_find_file2_misc()

const char* G_find_file2_misc ( const char *  dir,
const char *  element,
const char *  name,
const char *  mapset 
)

Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)

Returns the mapset name where the misc file was found. Paths to misc files currently follow structure: mapset/dir/name/element

Parameters
dirfile directory
elementdatabase element (eg, "cell", "cellhd", "colr", etc)
namefile name to look for
mapsetmapset to search. if mapset is "" will search in mapset search list
Returns
pointer to a string with name of mapset where file was found, or NULL if not found

Definition at line 270 of file find_file.c.

Referenced by G_find_raster3d(), G_has_raster3d_timestamp(), G_has_raster_timestamp(), I_find_group_file(), I_find_group_file2(), I_find_subgroup(), I_find_subgroup2(), I_find_subgroup_file(), I_find_subgroup_file2(), Rast_read_fp_range(), Rast_read_histogram(), and Rast_read_range().

◆ G_find_file_misc()

const char* G_find_file_misc ( const char *  dir,
const char *  element,
char *  name,
const char *  mapset 
)

Searches for a misc file from the mapset search list or in a specified mapset.

Returns the mapset name where the misc file was found. Paths to misc files currently follow structure: mapset/dir/name/element

Parameters
dirfile directory
elementdatabase element (eg, "cell", "cellhd", "colr", etc)
namefile name to look for
mapsetmapset to search. if mapset is "" will search in mapset search list
Returns
pointer to a string with name of mapset where file was found, or NULL if not found

Definition at line 224 of file find_file.c.

Referenced by Rast3d_mask_file_exists().