summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-23 09:08:52 +0000
committerrubidium <rubidium@openttd.org>2009-12-23 09:08:52 +0000
commit91747d72dca21fb92490738d90adc4a27989df04 (patch)
treebb843fc5f0bb04e34dce4089e6429826ea89fa96 /src/fileio.cpp
parent6e97343df64d2dafd1a7b5c1327b40b5abe297b9 (diff)
downloadopenttd-91747d72dca21fb92490738d90adc4a27989df04.tar.xz
(svn r18611) -Fix (r18608): uppercase-to-lowercase conversion when opening a file wasn't applied when finding the full path of a file
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index c6074de20..471b9dde5 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -272,6 +272,13 @@ char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char
FOR_ALL_SEARCHPATHS(sp) {
FioGetFullPath(buf, buflen, sp, subdir, filename);
if (FileExists(buf)) break;
+#if !defined(WIN32)
+ /* Be, as opening files, aware that sometimes the filename
+ * might be in uppercase when it is in lowercase on the
+ * disk. Ofcourse Windows doesn't care about casing. */
+ strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1));
+ if (FileExists(buf)) break;
+#endif
}
return buf;
@@ -968,7 +975,7 @@ void DeterminePaths(const char *exe)
FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
/* Create the directory for each of the types of content */
- const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, DATA_DIR, AI_DIR, AI_LIBRARY_DIR };
+ const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, DATA_DIR, AI_DIR, AI_LIBRARY_DIR, GM_DIR };
for (uint i = 0; i < lengthof(dirs); i++) {
char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]);
FioCreateDirectory(tmp);