From 5a103442f8debc421ae7c79ac9bc3cf85eb7ced7 Mon Sep 17 00:00:00 2001 From: Thraix Date: Thu, 11 Jul 2019 19:15:13 +0200 Subject: [PATCH] Fix h file generated by dependency to appear in current src directory --- Makefile | 2 +- src/Common.h | 2 +- src/HFileGen.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 641ac87..b5b319e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# This Makefile was generated using MakeGen v1.1.2 made by Tim HÃ¥kansson +# This Makefile was generated using MakeGen v1.1.3 made by Tim HÃ¥kansson # and is licensed under MIT. Full source of the project can be found at # https://github.com/Thraix/MakeGen CC=@g++ diff --git a/src/Common.h b/src/Common.h index 8f28e27..e11e286 100755 --- a/src/Common.h +++ b/src/Common.h @@ -13,7 +13,7 @@ // Release , should be backwards compatible with any minor version #define MAKEGEN_VERSION_RELEASE 1 // Minor changes, should be compatible with any other minor version with same major and release. -#define MAKEGEN_VERSION_MINOR 2 +#define MAKEGEN_VERSION_MINOR 3 #define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR)) const static unsigned int FLAG_HELP = BIT(0); diff --git a/src/HFileGen.cpp b/src/HFileGen.cpp index 1b111da..9e99353 100644 --- a/src/HFileGen.cpp +++ b/src/HFileGen.cpp @@ -7,7 +7,8 @@ void HFileGen::Create(const ConfigFile& conf) { std::set hFiles; std::vector files; - FileUtils::GetAllFiles(conf.srcdir,files); + std::string path = conf.configPath + conf.srcdir; + FileUtils::GetAllFiles(path,files); // include paramenter with the path of the file // For example src/graphics/Window.h -> graphics/Window.h if src is a src folder for(auto it = files.begin(); it!=files.end();++it) @@ -15,16 +16,17 @@ void HFileGen::Create(const ConfigFile& conf) size_t extensionPos = it->find_last_of("."); if(extensionPos != std::string::npos) { - std::string filename = it->substr(conf.srcdir.length()); - if(it->substr(extensionPos+1) == "h" && filename != conf.hFile) + std::string filename = it->substr(path.length()); + if(it->substr(extensionPos+1) == "h" && filename != conf.configPath + conf.hFile) { // Make files sorted in alphabetical order hFiles.emplace(filename); } } } + LOG_INFO(conf.configPath); - std::ofstream os(conf.srcdir+"/"+conf.hFile); + std::ofstream os(conf.configPath + conf.srcdir+"/"+conf.hFile); os << "#pragma once" << std::endl << std::endl; for(auto&& hFile : hFiles) os << "#include <" << hFile << ">" << std::endl;