diff --git a/src/fileio.cpp b/src/fileio.cpp index 09329b84f5..c6eb90ca97 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