Loading...
Searching...
No Matches
mapset.c File Reference

GIS library - environment routines (mapset). More...

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

Go to the source code of this file.

## Functions

const char * | G_mapset (void)
| Get current mapset name.
const char * | G__mapset (void)
| Get current mapset name (internal use only).
char * | G_mapset_path (void)
| Get current mapset UNIX-like path.
char * | G__mapset_path (void)
| Get current mapset UNIX-like path (internal use only).

## Detailed Description

GIS library - environment routines (mapset).

(C) 2001-2009, 2012 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 mapset.c.

## Function Documentation

## G__mapset()

const char * G__mapset | ( | void |  | ) |

Get current mapset name (internal use only).

See G_mapset().

Returns
  pointer mapset name
  NULL on error

Definition at line 51 of file mapset.c.

References G_getenv_nofatal().

Referenced by G__mapset_path(), and G_mapset().

## G__mapset_path()

char * G__mapset_path | ( | void |  | ) |

Get current mapset UNIX-like path (internal use only).

Allocated buffer should be freed by G_free(). See also G_mapset_path().

Todo
  Support also Windows-like path (?)

Returns
  buffer with mapset path

Definition at line 96 of file mapset.c.

References G__mapset(), G_gisdbase(), and G_location().

Referenced by G_mapset_path().

## G_mapset()

const char * G_mapset | ( | void |  | ) |

Get current mapset name.

Returns the name of the current mapset in the current location. This routine is often used when accessing files in the current mapset. See Mapsets for an explanation of mapsets.

G_fatal_error() is called on error.

Returns
  mapset name

Definition at line 33 of file mapset.c.

References G__mapset(), and G_fatal_error().

Referenced by check_mapset_in_layer_name(), G__get_list_of_mapsets(), G__gisinit(), G_check_input_output_name(), G_fopen_append(), G_fopen_append_misc(), G_fopen_modify(), G_fopen_modify_misc(), G_fopen_new(), G_fopen_new_misc(), G_get_window(), G_make_mapset_dir_object(), G_make_mapset_element(), G_make_mapset_element_tmp(), G_make_mapset_object_group(), G_make_mapset_object_group_basedir(), G_make_mapset_object_group_tmp(), G_open_new(), G_open_new_misc(), G_open_update(), G_open_update_misc(), G_read_vector_timestamp(), G_rename(), G_tempfile_pid(), G_tempfile_pid_basedir(), G_write_vector_timestamp(), Gs_save_3dview(), IL_resample_output_2d(), M__empty(), M_do_copy(), M_do_remove(), M_do_rename(), and main().

## G_mapset_path()

char * G_mapset_path | ( | void |  | ) |

Get current mapset UNIX-like path.

Allocated buffer should be freed by G_free(). See G__mapset_path().

Returns the full UNIX path name of the current mapset. For example, if the user is working in mapset user1, location spearfish in the /home/user/grassdata database directory, this routine will return a string which looks like /home/user/grassdata/spearfish/user1.

This function also checks if mapset path is readable by the current user. It calls G_fatal_error() on failure.

Returns
  buffer with location path

Definition at line 73 of file mapset.c.

References G__mapset_path(), and G_fatal_error().