grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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. More...
 
const char * G__mapset (void)
 Get current mapset name (internal use only) More...
 
char * G_mapset_path (void)
 Get current mapset UNIX-like path. More...
 
char * G__mapset_path (void)
 Get current mapset UNIX-like path (internal use only) More...
 

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(), check_overwrite(), close_new(), close_new_gdal(), create_raster(), D_open_driver(), db_set_default_connection(), file_name(), fopen_group_file_old(), fopen_subgroup_file_old(), G__get_list_of_mapsets(), G__gisinit(), G__open(), G__open_misc(), G__remove(), 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_element(), G_make_mapset_element_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_write_vector_timestamp(), get_ref(), Gs_save_3dview(), I_find_group(), I_find_group_file(), I_find_signature_file(), I_find_subgroup(), I_find_subgroup_file(), I_fopen_group_file_append(), I_fopen_group_file_new(), I_fopen_sigset_file_new(), I_fopen_subgroup_file_append(), I_fopen_subgroup_file_new(), I_get_control_points(), I_get_group(), I_list_subgroups(), I_location_info(), I_put_control_points(), IL_resample_output_2d(), list_element(), M__empty(), M_do_copy(), M_do_remove(), M_do_rename(), main(), map_format(), misc_write_line(), open_env(), open_new(), open_raster_new(), Rast3d_getFullWindowPath(), Rast3d_mask_file_exists(), Rast3d_mask_open_old(), Rast3d_open_cell_new(), Rast3d_write_colors(), Rast__check_for_auto_masking(), Rast__close_null(), Rast__mask_info(), Rast__open_null_write(), Rast__quant_export(), Rast__quant_import(), Rast_put_cell_title(), Rast_put_reclass(), Rast_read_colors(), Rast_remove_colors(), Rast_short_history(), Rast_write_colors(), Rast_write_range(), read_gdal_options(), V1_close_ogr(), Vect__delete(), Vect__open_old(), Vect_check_input_output_name(), Vect_close(), Vect_copy(), Vect_hist_command(), Vect_read_colors(), Vect_remove_colors(), Vect_rename(), Vect_save_fidx(), Vect_set_db_updated(), Vect_write_colors(), write_cats(), write_timestamp(), and writeRange().

◆ 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().