Fixed #1864 (Relative Path of #include-File doesn't work)

This commit is contained in:
Daniel Marjamäki 2010-07-27 18:07:30 +02:00
parent 2fd2ab1712
commit 81d7a37b68
1 changed files with 12 additions and 8 deletions

View File

@ -1404,17 +1404,21 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
std::string processedFile; std::string processedFile;
bool fileOpened = false; bool fileOpened = false;
std::ifstream fin; std::ifstream fin;
for (std::list<std::string>::const_iterator iter = includePaths.begin(); iter != includePaths.end(); ++iter)
{ {
fin.open((*iter + filename).c_str()); std::list<std::string> includePaths2(includePaths);
if (fin.is_open()) includePaths2.push_front("");
for (std::list<std::string>::const_iterator iter = includePaths2.begin(); iter != includePaths2.end(); ++iter)
{ {
filename = *iter + filename; fin.open((*iter + filename).c_str());
fileOpened = true; if (fin.is_open())
break; {
} filename = *iter + filename;
fileOpened = true;
break;
}
fin.clear(); fin.clear();
}
} }
if (headerType == UserHeader && !fileOpened) if (headerType == UserHeader && !fileOpened)