Skip to content

Commit 29be078

Browse files
author
Tal Hadad
committed
fix the absolute path case
1 parent 1155084 commit 29be078

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

simplecpp.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,8 +3221,9 @@ static std::string findPathInMapBothRelativeAndAbsolute(const std::map<std::stri
32213221
}
32223222
} else {
32233223
const std::string absolutePath = toAbsolutePath(path);
3224-
if (filedata.find(absolutePath) != filedata.end())
3224+
if (filedata.find(absolutePath) != filedata.end()) {
32253225
return absolutePath;
3226+
}
32263227
}
32273228
// otherwise
32283229
return "";
@@ -3235,7 +3236,10 @@ static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenLis
32353236
}
32363237
if (isAbsolutePath(header)) {
32373238
const std::string simplifiedHeaderPath = simplecpp::simplifyPath(header);
3238-
return (filedata.find(simplifiedHeaderPath) != filedata.end()) ? simplifiedHeaderPath : "";
3239+
const std::string match = findPathInMapBothRelativeAndAbsolute(filedata, simplifiedHeaderPath);
3240+
if (!match.empty()) {
3241+
return match;
3242+
}
32393243
}
32403244

32413245
if (!systemheader) {

0 commit comments

Comments
 (0)