Use \ as slash.
@@ -2219,7 +2219,7 @@ static int file_found_p (const char *name) {
static const char *get_full_name (c2m_ctx_t c2m_ctx, const char *base, const char *name,
int dir_base_p) {
- const char *str, *last;
+ const char *str, *last, *slash;
size_t len;
VARR_TRUNC (char, temp_string, 0);
@@ -2227,13 +2227,19 @@ static const char *get_full_name (c2m_ctx_t c2m_ctx, const char *base, const cha
assert (name != NULL && name[0] != '\0');
return name;
}
+#ifdef _WIN32
+ slash = "\\";
+#else
+ slash = "/";
+#endif
if (dir_base_p) {
len = strlen (base);
assert (len > 0);
add_to_temp_string (c2m_ctx, base);
- if (base[len - 1] != '/') add_to_temp_string (c2m_ctx, "/");
- } else if ((last = strrchr (base, '/')) == NULL) {
- add_to_temp_string (c2m_ctx, "./");
+ if (base[len - 1] != slash[0]) add_to_temp_string (c2m_ctx, slash);
+ } else if ((last = strrchr (base, slash[0])) == NULL) {
+ add_to_temp_string (c2m_ctx, ".");
+ add_to_temp_string (c2m_ctx, slash);
} else {
for (str = base; str <= last; str++) VARR_PUSH (char, temp_string, *str);
VARR_PUSH (char, temp_string, '\0');
