summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fileio.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 09329b84f..c6eb90ca9 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -315,7 +315,7 @@ FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subd
f = fopen(buf, mode);
#if !defined(WIN32)
if (f == NULL) {
- strtolower(buf + strlen(_searchpaths[sp]) - 1);
+ strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1));
f = fopen(buf, mode);
}
#endif