summaryrefslogtreecommitdiff
path: root/src/strgen
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2019-03-10 16:52:13 +0100
committerPatric Stout <truebrain@openttd.org>2019-03-11 10:16:00 +0100
commitaea1726f45735a6768884a3f49f8f5ffcf2337e2 (patch)
tree2371f5c96b46f5a2bdf38cf53177130409a64532 /src/strgen
parent45fbaa64c231d6cd2e0831f872dc9df41955eb12 (diff)
downloadopenttd-aea1726f45735a6768884a3f49f8f5ffcf2337e2.tar.xz
Fix: MingW and MSVC compiled strgen had different path separator behaviour
If it was compiled with MingW, both / and \ were accepted as path separator. On MSVC, only \ was. This is an unexpected difference between binaries for the same platform. Remove this discrepancy by accepting both / and \ on all platforms.
Diffstat (limited to 'src/strgen')
-rw-r--r--src/strgen/strgen.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 80fe49a48..11e6b8dbd 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -392,11 +392,13 @@ static inline char *mkpath(char *buf, const char *last, const char *path, const
return buf;
}
-#if defined(__MINGW32__)
+#if defined(_WIN32)
/**
* On MingW, it is common that both / as \ are accepted in the
* params. To go with those flow, we rewrite all incoming /
- * simply to \, so internally we can safely assume \.
+ * simply to \, so internally we can safely assume \, and do
+ * this for all Windows machines to keep identical behaviour,
+ * no matter what your compiler was.
*/
static inline char *replace_pathsep(char *s)
{