carb::crashreporter::addExtraCrashFile

Defined in carb/crashreporter/CrashReporterUtils.h

inline bool carb::crashreporter::addExtraCrashFile(const char *keyName, const char *filename)

Adds an extra file to be uploaded when a crash occurs.

Remark

This adds a filename to be tracked to upload with the next crash report that is generated. This setting is not persistent across sessions. If no crash occurs, the file will not be uploaded anywhere. This cannot be used to rename a file that has already been added to the upload list (ie: change the filename under an existing key). If a second filename is specified with the same key, it will be ignored.

Note

Extra files added with this function will not be deleted once a crash report is successfully uploaded. Only the crash report’s main dump file and metadata files will be deleted in this case.

Parameters
  • keyName[in] The name of the key to give to the file. This is what the file will be uploaded as. Using the file’s original name should be fine in most cases, however it should not contain characters such as ‘/’ or ‘' at the very least. Non-ASCII characters should be avoided if possible too. It is the caller’s responsibility to ensure adding this new file will not overwrite another upload file with the same key name. This may not use the reserved name ‘upload_file_minidump’. This key name string will always be sanitized to only contain database friendly characters. All invalid characters will be replaced by an underscore (‘_’).

  • filename[in] The full path to the file to upload. This may be a relative or absolute path. The file may or may not exist at the time of this call, it will still be added to the list of files to be uploaded. If the file does not exist at the time of the crash, it will be filtered out of the list at that point. A warnings message will be written out for each listed file that is missing at the time of the crash however.

Returns

true if the new entry is added to the list. Returns false if the file could not be added. This failure will only occur if the carb::settings::ISettings interface is not available. Note that a true return does not necessarily mean that the new file was fully added to the list. It would have been written to the list in the settings registry, but may have been ignored by the crash reporter if the same key was given as a previous file.