@@ -3205,8 +3205,10 @@ static std::string getIncludePathFileName(const std::string &includePath, const
32053205 std::string basePath = toAbsolutePath (includePath);
32063206 if (!basePath.empty () && basePath[basePath.size ()-1U ]!=' /' && basePath[basePath.size ()-1U ]!=' \\ ' )
32073207 basePath += ' /' ;
3208- const std::string absoluteSimplifiedHeaderPath = basePath + simplifiedHeader;
3209- return extractRelativePathFromAbsolute (absoluteSimplifiedHeaderPath);
3208+ const std::string absoluteSimplifiedHeaderPath = simplecpp::simplifyPath (basePath + simplifiedHeader);
3209+ // std::cout << "absoluteSimplifiedHeaderPath: " << absoluteSimplifiedHeaderPath << std::endl;
3210+ // preserve absoluteness/relativieness of the including dir
3211+ return isAbsolutePath (includePath) ? absoluteSimplifiedHeaderPath : extractRelativePathFromAbsolute (absoluteSimplifiedHeaderPath);
32103212}
32113213
32123214static std::string openHeaderIncludePath (std::ifstream &f, const simplecpp::DUI &dui, const std::string &header)
@@ -3227,8 +3229,8 @@ static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const
32273229 // prefer first to search the header relatively to source file if found, when not a system header
32283230 if (!systemheader) {
32293231 std::string relativeHeader = openHeaderRelative (f, sourcefile, header);
3230- if (endsWith (header, " filelister.h" ))// temp printing
3231- std::cout << " relativeHeader: " << relativeHeader << " sourcefile: " << sourcefile << " header: " << header << std::endl;
3232+ // if (endsWith(header, "filelister.h"))// temp printing
3233+ // std::cout << "relativeHeader: " << relativeHeader << " sourcefile: " << sourcefile << " header: " << header << std::endl;
32323234 if (!relativeHeader.empty ()) {
32333235 return relativeHeader;
32343236 }
@@ -3266,6 +3268,7 @@ static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenLis
32663268 if (isAbsolutePath (header)) {
32673269 const std::string simplifiedHeaderPath = simplecpp::simplifyPath (header);
32683270 const std::string match = findPathInMapBothRelativeAndAbsolute (filedata, simplifiedHeaderPath);
3271+ // std::cout << "simplifiedHeaderPath: " << simplifiedHeaderPath << " match: " << match << std::endl;
32693272 if (!match.empty ()) {
32703273 return match;
32713274 }
@@ -3274,6 +3277,7 @@ static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenLis
32743277 if (!systemheader) {
32753278 const std::string relativeOrAbsoluteFilename = getRelativeFileName<true , true >(sourcefile, header);// unknown if absolute or relative, but always simplified
32763279 const std::string match = findPathInMapBothRelativeAndAbsolute (filedata, relativeOrAbsoluteFilename);
3280+ // std::cout << "relativeOrAbsoluteFilename: " << relativeOrAbsoluteFilename << " match: " << match << std::endl;
32773281 if (!match.empty ()) {
32783282 return match;
32793283 }
@@ -3283,6 +3287,7 @@ static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenLis
32833287
32843288 for (std::list<std::string>::const_iterator it = dui.includePaths .begin (); it != dui.includePaths .end (); ++it) {
32853289 const std::string match = findPathInMapBothRelativeAndAbsolute (filedata, getIncludePathFileName (*it, header));
3290+ // std::cout << "match: " << match << std::endl;
32863291 if (!match.empty ()) {
32873292 return match;
32883293 }
0 commit comments