16 #include <grass/gis.h>
18 #include "gis_local_proto.h"
20 static char *file_name(
char *,
const char *,
const char *,
const char *,
21 const char *,
const char *);
22 static void append_char(
char *,
char);
102 const char *
name,
const char *mapset)
129 char tmp_path[GPATH_MAX] = {0};
131 env = getenv(
"GRASS_VECTOR_TMPDIR_MAPSET");
132 if (env && strcmp(env,
"0") == 0) {
133 snprintf(tmp_path, GPATH_MAX,
"%s", getenv(
"TMPDIR"));
156 const char *mapset,
const char *basedir)
161 char *file_name(
char *
path,
const char *dir,
const char *
element,
162 const char *
name,
const char *mapset,
const char *base)
164 const char *pname =
name;
165 char xname[GNAME_MAX] = {
'\0'};
168 sprintf(
path,
"%s", base);
171 char xmapset[GMAPSET_MAX] = {
'\0'};
181 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP, xmapset);
183 else if (mapset && *mapset)
184 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP, mapset);
186 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP,
G_mapset());
191 append_char(
path, HOST_DIRSEP);
194 if (pname && *pname) {
195 append_char(
path, HOST_DIRSEP);
200 append_char(
path, HOST_DIRSEP);
206 append_char(
path, HOST_DIRSEP);
210 if (pname && *pname) {
211 append_char(
path, HOST_DIRSEP);
221 void append_char(
char *s,
char c)
void G_free(void *buf)
Free allocated memory.
int G_debug(int level, const char *msg,...)
Print debugging message.
char * G_file_name_basedir(char *path, const char *element, const char *name, const char *mapset, const char *basedir)
Builds full path names to GIS data files in temporary directory (for internal use only)
char * G_file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
char * G_file_name_tmp(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files in temporary directory (for internal use only)
char * G_file_name_misc(char *path, const char *dir, const char *element, const char *name, const char *mapset)
Builds full path names to GIS misc data files.
char * G__location_path(void)
Get current location UNIX-like path (internal use only)
const char * G_mapset(void)
Get current mapset name.
int G_name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)