diff --git a/src/FileService.cpp b/src/FileService.cpp index b4bf937..a5a03b7 100644 --- a/src/FileService.cpp +++ b/src/FileService.cpp @@ -22,8 +22,13 @@ void FileService::createOrOverwriteFile(std::string path, std::string content) { }; void FileService::appendToFile(std::string path, std::string content) { + bool fileNotEmpty = FileService::doesNonEmptyFileExist(path); std::stringstream cmd; - cmd << ECHO_PATH << " \"" << "\n" << content << "\" >> " << path; + if (fileNotEmpty) { + cmd << ECHO_PATH << " \"" << "\n" << content << "\" >> " << path; + } else { + cmd << ECHO_PATH << " \"" << content << "\" >> " << path; + } ShellService::exec(cmd.str().c_str()); };