diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 93c9582d8..c938a8e8c 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1404,17 +1404,21 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath std::string processedFile; bool fileOpened = false; std::ifstream fin; - for (std::list::const_iterator iter = includePaths.begin(); iter != includePaths.end(); ++iter) { - fin.open((*iter + filename).c_str()); - if (fin.is_open()) + std::list includePaths2(includePaths); + includePaths2.push_front(""); + for (std::list::const_iterator iter = includePaths2.begin(); iter != includePaths2.end(); ++iter) { - filename = *iter + filename; - fileOpened = true; - break; - } + fin.open((*iter + filename).c_str()); + if (fin.is_open()) + { + filename = *iter + filename; + fileOpened = true; + break; + } - fin.clear(); + fin.clear(); + } } if (headerType == UserHeader && !fileOpened)