Misc: Add missing error reporting to a couple of WriteBinaryFiles()
This commit is contained in:
parent
227c249d7f
commit
43e7be902c
|
@ -381,9 +381,10 @@ void Achievements::DownloadImage(std::string url, std::string cache_path)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!FileSystem::WriteBinaryFile(cache_path.c_str(), data.data(), data.size()))
|
||||
Error write_error;
|
||||
if (!FileSystem::WriteBinaryFile(cache_path.c_str(), data, &write_error))
|
||||
{
|
||||
ERROR_LOG("Failed to write badge image to '{}'", cache_path);
|
||||
ERROR_LOG("Failed to write badge image to '{}': {}", cache_path, write_error.GetDescription());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -348,12 +348,15 @@ bool QtHost::DownloadFile(QWidget* parent, const QString& title, std::string url
|
|||
|
||||
// Directory may not exist. Create it.
|
||||
const std::string directory(Path::GetDirectory(path));
|
||||
Error error;
|
||||
if ((!directory.empty() && !FileSystem::DirectoryExists(directory.c_str()) &&
|
||||
!FileSystem::CreateDirectory(directory.c_str(), true)) ||
|
||||
!FileSystem::WriteBinaryFile(path, data.data(), data.size()))
|
||||
!FileSystem::CreateDirectory(directory.c_str(), true, &error)) ||
|
||||
!FileSystem::WriteBinaryFile(path, data, &error))
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Failed to write '%1'.").arg(QString::fromUtf8(path)));
|
||||
qApp->translate("QtHost", "Failed to write '%1':\n%2")
|
||||
.arg(QString::fromUtf8(path))
|
||||
.arg(QString::fromUtf8(error.GetDescription())));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue