mirror of https://github.com/WerWolv/ImHex.git
patterns: Fixed #include not properly searching all include folders
This commit is contained in:
parent
929437c159
commit
7562e8b172
|
@ -63,17 +63,19 @@ namespace hex::pl {
|
||||||
}
|
}
|
||||||
offset += 1;
|
offset += 1;
|
||||||
|
|
||||||
|
std::string includePath = includeFile;
|
||||||
|
|
||||||
if (includeFile[0] != '/') {
|
if (includeFile[0] != '/') {
|
||||||
std::string tempPath = includeFile;
|
|
||||||
for (const auto &dir : hex::getPath(ImHexPath::PatternsInclude)) {
|
for (const auto &dir : hex::getPath(ImHexPath::PatternsInclude)) {
|
||||||
tempPath = hex::format("{0}/{1}", dir.c_str(), includeFile.c_str());
|
std::string tempPath = hex::format("{0}/{1}", dir.c_str(), includeFile.c_str());
|
||||||
if (std::filesystem::exists(includeFile))
|
if (std::filesystem::exists(tempPath)) {
|
||||||
|
includePath = tempPath;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
includeFile = tempPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
File file(includeFile, File::Mode::Read);
|
File file(includePath, File::Mode::Read);
|
||||||
if (!file.isValid())
|
if (!file.isValid())
|
||||||
throwPreprocessorError(hex::format("{0}: No such file or directory", includeFile.c_str()), lineNumber);
|
throwPreprocessorError(hex::format("{0}: No such file or directory", includeFile.c_str()), lineNumber);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue