Fix absolute paths causing Makefile errors

This commit is contained in:
Thraix
2025-06-04 21:31:33 +02:00
parent f6caefb078
commit d3c334dc79
6 changed files with 26 additions and 11 deletions
+9 -5
View File
@@ -15,7 +15,7 @@ class IncludeDeps
{
public:
std::map<std::string, IncludeDeps*> dependencies;
std::string filepath;
std::filesystem::path filepath;
bool projectHFile;
static std::set<std::string> printSet;
static int printCounter;
@@ -28,14 +28,18 @@ class IncludeDeps
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
{
std::string filePathRelativeToConfig = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath, "./").string();
if(printSet.find(filePathRelativeToConfig) != printSet.end())
std::string filePathInMakeFile = filepath;
if(!filepath.is_absolute())
filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
if(printSet.find(filePathInMakeFile) != printSet.end())
return stream;
printSet.emplace(filePathRelativeToConfig);
printSet.emplace(filePathInMakeFile);
printCounter++;
if(!projectHFile)
{
stream << " " << filePathRelativeToConfig;
stream << " " << filePathInMakeFile;
}
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
{