/*! * \brief 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. * * \return pointer mapset name */ const char *G_mapset(void) { const char *m = G__mapset(); if (!m) G_fatal_error(_("MAPSET is not set")); return m; }
/*! \brief 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 (?) \return buffer with mapset path */ char *G__mapset_path(void) { const char *mapset = G__mapset(); const char *location = G_location(); const char *base = G_gisdbase(); char *mapset_path = G_malloc(strlen(base) + strlen(location) + strlen(mapset) + 3); sprintf(mapset_path, "%s/%s/%s", base, location, mapset); return mapset_path; }