|
@@ -17,8 +17,9 @@
|
|
|
|
|
|
#include "gis_local_proto.h"
|
|
#include "gis_local_proto.h"
|
|
|
|
|
|
-char *file_name(char *, const char *, const char *,
|
|
|
|
- const char *, const char *, const char *);
|
|
|
|
|
|
+static char *file_name(char *, const char *, const char *,
|
|
|
|
+ const char *, const char *, const char *);
|
|
|
|
+static void append_char(char*, char);
|
|
|
|
|
|
/*!
|
|
/*!
|
|
\brief Builds full path names to GIS data files
|
|
\brief Builds full path names to GIS data files
|
|
@@ -112,37 +113,37 @@ char *file_name(char *path,
|
|
*/
|
|
*/
|
|
if (name && *name && G_name_is_fully_qualified(name, xname, xmapset)) {
|
|
if (name && *name && G_name_is_fully_qualified(name, xname, xmapset)) {
|
|
pname = xname;
|
|
pname = xname;
|
|
- sprintf(path, "%s/%s", location, xmapset);
|
|
|
|
|
|
+ sprintf(path, "%s%c%s", location, HOST_DIRSEP, xmapset);
|
|
}
|
|
}
|
|
else if (mapset && *mapset)
|
|
else if (mapset && *mapset)
|
|
- sprintf(path, "%s/%s", location, mapset);
|
|
|
|
|
|
+ sprintf(path, "%s%c%s", location, HOST_DIRSEP, mapset);
|
|
else
|
|
else
|
|
- sprintf(path, "%s/%s", location, G_mapset());
|
|
|
|
|
|
+ sprintf(path, "%s%c%s", location, HOST_DIRSEP, G_mapset());
|
|
G_free(location);
|
|
G_free(location);
|
|
}
|
|
}
|
|
|
|
|
|
if (dir && *dir) { /* misc element */
|
|
if (dir && *dir) { /* misc element */
|
|
- strcat(path, "/");
|
|
|
|
|
|
+ append_char(path, HOST_DIRSEP);
|
|
strcat(path, dir);
|
|
strcat(path, dir);
|
|
|
|
|
|
if (pname && *pname) {
|
|
if (pname && *pname) {
|
|
- strcat(path, "/");
|
|
|
|
|
|
+ append_char(path, HOST_DIRSEP);
|
|
strcat(path, pname);
|
|
strcat(path, pname);
|
|
}
|
|
}
|
|
|
|
|
|
if (element && *element) {
|
|
if (element && *element) {
|
|
- strcat(path, "/");
|
|
|
|
|
|
+ append_char(path, HOST_DIRSEP);
|
|
strcat(path, element);
|
|
strcat(path, element);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
if (element && *element) {
|
|
if (element && *element) {
|
|
- strcat(path, "/");
|
|
|
|
|
|
+ append_char(path, HOST_DIRSEP);
|
|
strcat(path, element);
|
|
strcat(path, element);
|
|
}
|
|
}
|
|
|
|
|
|
if (pname && *pname) {
|
|
if (pname && *pname) {
|
|
- strcat(path, "/");
|
|
|
|
|
|
+ append_char(path, HOST_DIRSEP);
|
|
strcat(path, pname);
|
|
strcat(path, pname);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -151,3 +152,10 @@ char *file_name(char *path,
|
|
|
|
|
|
return path;
|
|
return path;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void append_char(char* s, char c)
|
|
|
|
+{
|
|
|
|
+ int len = strlen(s);
|
|
|
|
+ s[len] = c;
|
|
|
|
+ s[len+1] = '\0';
|
|
|
|
+}
|