Loading...
Searching...
No Matches
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.
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.
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).
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).

## 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@mapset) 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

  element | database element (eg, "cell", "cellhd", "colr", etc)
  name | file name to look for
  mapset | mapset 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 186 of file find_file.c.

References name, and NULL.

Referenced by G_find_raster(), G_find_vector(), IL_output_2d(), IL_resample_output_2d(), and S_read().

## 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

  element | database element (eg, "cell", "cellhd", "colr", etc)
  name | file name to look for
  mapset | mapset 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 234 of file find_file.c.

References name, and NULL.

Referenced by G_find_raster2(), G_find_vector2(), G_get_3dview(), Gs_load_3dview(), IL_resample_output_2d(), and M_find().

## 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

  dir | file directory
  element | database element (eg, "cell", "cellhd", "colr", etc)
  name | file name to look for
  mapset | mapset 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 257 of file find_file.c.

References name.

Referenced by G_find_raster3d(), G_has_raster3d_timestamp(), and G_has_raster_timestamp().

## 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

  dir | file directory
  element | database element (eg, "cell", "cellhd", "colr", etc)
  name | file name to look for
  mapset | mapset 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 208 of file find_file.c.

References name.