00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <string.h>
00021 #include <grass/gis.h>
00022
00023 char *G__file_name (
00024 char *path,
00025 char *element,
00026 char *name,
00027 char *mapset)
00028 {
00029 char xname[512];
00030 char xmapset[512];
00031 char *location = G__location_path();
00032
00033
00034
00035
00036
00037
00038 if (name && *name && G__name_is_fully_qualified(name, xname, xmapset))
00039 {
00040 strcpy(name, xname);
00041 sprintf(path,"%s/%s", location, xmapset);
00042 }
00043 else if (mapset && *mapset)
00044 sprintf(path,"%s/%s", location, mapset);
00045 else
00046 sprintf(path,"%s/%s", location, G_mapset());
00047
00048 G_free (location);
00049
00050 if (element && *element)
00051 {
00052 strcat (path, "/");
00053 strcat (path, element);
00054 }
00055
00056 if (name && *name)
00057 {
00058 strcat (path, "/");
00059 strcat (path, name);
00060 }
00061
00062
00063
00064
00065 return path;
00066 }