GRASS GIS 7 Programmer's Manual
7.8.2(2019)-exported
|
Go to the documentation of this file.
16 #include <grass/gis.h>
18 #include "gis_local_proto.h"
20 static char *file_name(
char *,
const char *,
const char *,
21 const char *,
const char *,
const char *);
22 static void append_char(
char*,
char);
39 const char *
element,
const char *
name,
const char *mapset)
58 const char *
name,
const char *mapset)
82 const char *
name,
const char *mapset)
84 const char *env, *tmp_path;
87 env = getenv(
"GRASS_VECTOR_TMPDIR_MAPSET");
88 if (env && strcmp(env,
"0") == 0) {
89 tmp_path = getenv(
"TMPDIR");
95 char *file_name(
char *
path,
96 const char *dir,
const char *
element,
const char *
name,
97 const char *mapset,
const char *base)
99 const char *pname =
name;
102 sprintf(
path,
"%s", base);
105 char xname[GNAME_MAX];
106 char xmapset[GMAPSET_MAX];
116 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP, xmapset);
118 else if (mapset && *mapset)
119 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP, mapset);
121 sprintf(
path,
"%s%c%s", location, HOST_DIRSEP,
G_mapset());
126 append_char(
path, HOST_DIRSEP);
129 if (pname && *pname) {
130 append_char(
path, HOST_DIRSEP);
135 append_char(
path, HOST_DIRSEP);
141 append_char(
path, HOST_DIRSEP);
145 if (pname && *pname) {
146 append_char(
path, HOST_DIRSEP);
156 void append_char(
char* s,
char c)
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_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)
int G_name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)
const char * G_mapset(void)
Get current mapset name.
char * G__location_path(void)
Get current location UNIX-like path (internal use only)
void G_free(void *buf)
Free allocated memory.
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_debug(int level, const char *msg,...)
Print debugging message.