Fix merge result not saving to file correctly

This commit is contained in:
Vyn 2025-04-03 11:27:56 +02:00
parent 8a543a4a5a
commit 49d60ba5bc
4 changed files with 4 additions and 3 deletions

1
merger/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
codingame-ide-sync

Binary file not shown.

View file

@ -1,6 +1,7 @@
#include "codingame-sync.h"
#include "File.h"
#include <regex>
#include <stdexcept>
void copyFileTo(std::string* to, const File& file, std::map<std::string, bool>* includedFiles) {
(*to) += "/** cg-sync -> " + file.getName() + " **/\n\n";
@ -31,8 +32,9 @@ std::string merge(const std::string& entryFilePath) {
std::ofstream newFile("merge.cpp");
if (!newFile.is_open()) {
newFile << mergedFileContent;
throw new std::runtime_error("Can't open merge.cpp");
}
newFile << mergedFileContent;
newFile.close();
return mergedFileContent;
}