- [FIX] Ara soporta que varios arxius en diferents carpetes tinguen el mateix nom
This commit is contained in:
@@ -320,9 +320,17 @@ bool HeadersNeedRecompile(FileInfo file, std::filesystem::file_time_type object_
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MustRecompile(FileInfo file) {
|
||||
std::string object_file = build_path + folder_char + std::filesystem::path(file.filename).stem().string() + ".o";
|
||||
std::string generate_object_file_name(std::string filename) {
|
||||
std::filesystem::path cwd = std::filesystem::weakly_canonical(std::filesystem::current_path());
|
||||
std::filesystem::path target = std::filesystem::weakly_canonical(filename);
|
||||
std::string out = std::filesystem::relative(target, cwd).replace_extension("o").generic_string();
|
||||
for (char& c : out) if (c == folder_char[0]) c = '.';
|
||||
return build_path + folder_char + out;
|
||||
}
|
||||
|
||||
bool MustRecompile(FileInfo file) {
|
||||
std::string object_file = generate_object_file_name(file.filename);
|
||||
|
||||
// si el objecte no existeix, fa falta recompilar
|
||||
if (!std::filesystem::exists(object_file)) {
|
||||
return true;
|
||||
@@ -342,7 +350,7 @@ bool MustRecompile(FileInfo file) {
|
||||
}
|
||||
|
||||
void Recompile(std::string source_file) {
|
||||
std::string object_file = build_path + folder_char + std::filesystem::path(source_file).stem().string() + ".o";
|
||||
std::string object_file = generate_object_file_name(source_file);
|
||||
must_link = true;
|
||||
std::string command = compiler + " " + source_file + " " + cppflags + " -c -o " + object_file;
|
||||
//std::cout << command << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user