summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-07-16 18:43:22 +0000
committeralberth <alberth@openttd.org>2011-07-16 18:43:22 +0000
commitd55b380b695c184a6bfc99790f8ff738c84867cc (patch)
treec9f0dac6c86a885ba071d9497071083327e43620 /src/fileio.cpp
parent20c2b5fdde6f3f70dc0a955ef803b8a0fa21e0e5 (diff)
downloadopenttd-d55b380b695c184a6bfc99790f8ff738c84867cc.tar.xz
(svn r22669) -Codechange: For non-windows, only test for file existence again if strtolower actually changed the name.
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 2b0f67b1e..7ac5ce7da 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -320,8 +320,7 @@ char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char
/* 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 + strlen(_searchpaths[sp]) - 1);
- if (FileExists(buf)) return buf;
+ if (strtolower(buf + strlen(_searchpaths[sp]) - 1) && FileExists(buf)) return buf;
#endif
}
@@ -378,8 +377,7 @@ static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath s
f = fopen(buf, mode);
#if !defined(WIN32)
- if (f == NULL) {
- strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1));
+ if (f == NULL && strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1))) {
f = fopen(buf, mode);
}
#endif