12 #include <grass/config.h> 17 #include <sys/types.h> 19 #include <grass/gis.h> 20 #include <grass/glocale.h> 57 if (*element ==
'/' || *element == 0) {
59 if (access(path, 0) != 0) {
62 p_element, path, strerror(errno));
64 if (access(path, 0) != 0)
65 G_fatal_error(_(
"Unable to access mapset element %s (%s): %s"),
66 p_element, path, strerror(errno));
85 char buf[GNAME_MAX * 2 + 1];
87 sprintf(buf,
"%s/%s", dir, name);
91 static int check_owner(
const struct stat *info)
93 #if defined(__MINGW32__) || defined(SKIP_MAPSET_OWN_CHK) 96 const char *check = getenv(
"GRASS_SKIP_MAPSET_OWNER_CHECK");
99 if (info->st_uid != getuid())
101 if (info->st_uid != geteuid())
118 char path[GPATH_MAX];
123 if (
G_stat(path, &info) != 0)
125 if (!S_ISDIR(info.st_mode))
128 if (!check_owner(&info))
148 char path[GPATH_MAX];
151 sprintf(path,
"%s/%s/%s", gisdbase, location, mapset);
153 if (
G_stat(path, &info) != 0)
155 if (!S_ISDIR(info.st_mode))
158 if (!check_owner(&info))
int G_make_mapset_element(const char *p_element)
Create element in the current mapset.
int G_stat(const char *file_name, struct stat *buf)
Get file status.
int G_mkdir(const char *path)
Creates a new directory.
const char * G_mapset(void)
Get current mapset name.
int G_mapset_permissions(const char *mapset)
Check for user mapset permission.
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
char * G_file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
int G_mapset_permissions2(const char *gisdbase, const char *location, const char *mapset)
Check for user mapset permission.
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.