* Write the crash log to a file. * @note The filename will be written to \c crashlog_filename. * @return true when the crash log was successfully written. */
| 189 | * @return true when the crash log was successfully written. |
| 190 | */ |
| 191 | bool CrashLog::WriteCrashLog() |
| 192 | { |
| 193 | this->crashlog_filename = this->CreateFileName(".json.log"); |
| 194 | |
| 195 | auto file = FioFOpenFile(this->crashlog_filename, "w", NO_DIRECTORY); |
| 196 | if (!file.has_value()) return false; |
| 197 | |
| 198 | std::string survey_json = this->survey.dump(4); |
| 199 | |
| 200 | size_t len = survey_json.size(); |
| 201 | size_t written = fwrite(survey_json.data(), 1, len, *file); |
| 202 | |
| 203 | return len == written; |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Write the (crash) dump to a file. |
no test coverage detected