2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

core/reporter: Return in error case in SaveToFile()

If the path couldn't be created, then we shouldn't be attempting to save
the file.
This commit is contained in:
Lioncash 2019-07-05 17:02:29 -04:00
parent 772c86a260
commit 7ad11e3867

View file

@ -31,8 +31,10 @@ std::string GetTimestamp() {
using namespace nlohmann; using namespace nlohmann;
void SaveToFile(const json& json, const std::string& filename) { void SaveToFile(const json& json, const std::string& filename) {
if (!FileUtil::CreateFullPath(filename)) if (!FileUtil::CreateFullPath(filename)) {
LOG_ERROR(Core, "Failed to create path for '{}' to save report!", filename); LOG_ERROR(Core, "Failed to create path for '{}' to save report!", filename);
return;
}
std::ofstream file( std::ofstream file(
FileUtil::SanitizePath(filename, FileUtil::DirectorySeparator::PlatformDefault)); FileUtil::SanitizePath(filename, FileUtil::DirectorySeparator::PlatformDefault));