summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-10-28 00:18:57 +0000
committerDarkvater <Darkvater@openttd.org>2005-10-28 00:18:57 +0000
commit4cc9761cb5d7dd6e4b9b4e9676f856a6357e7dbc (patch)
treed7615fc0bd640a584b37ec7040d91cb7e73dc823
parent71fb375f8cf82522650d3ec7599b098de3fbd2ce (diff)
downloadopenttd-4cc9761cb5d7dd6e4b9b4e9676f856a6357e7dbc.tar.xz
(svn r3097) - Fix (regression): unix has a trailing slash after the paths, windows does not, no idea why os2 has. Way to go consistency :s. So anyways, just strip trailing slash
-rw-r--r--os2.c2
-rw-r--r--unix.c4
-rw-r--r--win32.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/os2.c b/os2.c
index 821ebf206..6aa5a61ca 100644
--- a/os2.c
+++ b/os2.c
@@ -356,6 +356,8 @@ char *FiosBrowseTo(const FiosItem *item)
case FIOS_TYPE_DIRECT:
sprintf(path, "%s\\", item->name);
+ s = strrchr(path, '\\');
+ if (s[1] == '\0') s[0] = '\0'; // strip trailing slash
break;
case FIOS_TYPE_FILE:
diff --git a/unix.c b/unix.c
index c9dcee80b..fd20e3715 100644
--- a/unix.c
+++ b/unix.c
@@ -312,7 +312,9 @@ char *FiosBrowseTo(const FiosItem *item)
break;
case FIOS_TYPE_DIRECT:
- sprintf(path, "%s\\", item->name);
+ sprintf(path, "%s/", item->name);
+ s = strrchr(path, '/');
+ if (s[1] == '\0') s[0] = '\0'; // strip trailing slash
break;
case FIOS_TYPE_FILE:
diff --git a/win32.c b/win32.c
index 8ef1caa81..68ef27705 100644
--- a/win32.c
+++ b/win32.c
@@ -919,6 +919,9 @@ char *FiosBrowseTo(const FiosItem *item)
case FIOS_TYPE_DIRECT:
sprintf(path, "%s\\", item->name);
+ s = strrchr(path, '\\');
+ if (s[1] == '\0') s[0] = '\0'; // strip trailing slash
+
break;
case FIOS_TYPE_FILE: