mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fixed a scraping issue where failed image writing was not handled correctly.
This commit is contained in:
parent
317719b678
commit
3f9c43afb9
|
@ -248,8 +248,8 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
#else
|
#else
|
||||||
std::ofstream stream(filePath, std::ios_base::out | std::ios_base::binary);
|
std::ofstream stream(filePath, std::ios_base::out | std::ios_base::binary);
|
||||||
#endif
|
#endif
|
||||||
if (stream.bad()) {
|
if (!stream || stream.bad()) {
|
||||||
setError("Failed to open image path to write. Permission error? Disk full?");
|
setError("Failed to open path for writing image.\nPermission error?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,14 +257,14 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
stream.write(content.data(), content.length());
|
stream.write(content.data(), content.length());
|
||||||
stream.close();
|
stream.close();
|
||||||
if (stream.bad()) {
|
if (stream.bad()) {
|
||||||
setError("Failed to save image. Disk full?");
|
setError("Failed to save image.\nDisk full?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize it.
|
// Resize it.
|
||||||
if (!resizeImage(filePath, Settings::getInstance()->getInt("ScraperResizeMaxWidth"),
|
if (!resizeImage(filePath, Settings::getInstance()->getInt("ScraperResizeMaxWidth"),
|
||||||
Settings::getInstance()->getInt("ScraperResizeMaxHeight"))) {
|
Settings::getInstance()->getInt("ScraperResizeMaxHeight"))) {
|
||||||
setError("Error saving resized image. Out of memory? Disk full?");
|
setError("Error saving resized image.\nOut of memory? Disk full?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,8 +365,8 @@ void ImageDownloadHandle::update()
|
||||||
#else
|
#else
|
||||||
std::ofstream stream(mSavePath, std::ios_base::out | std::ios_base::binary);
|
std::ofstream stream(mSavePath, std::ios_base::out | std::ios_base::binary);
|
||||||
#endif
|
#endif
|
||||||
if (stream.bad()) {
|
if (!stream || stream.bad()) {
|
||||||
setError("Failed to open image path to write. Permission error? Disk full?");
|
setError("Failed to open path for writing image.\nPermission error?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,13 +374,13 @@ void ImageDownloadHandle::update()
|
||||||
stream.write(content.data(), content.length());
|
stream.write(content.data(), content.length());
|
||||||
stream.close();
|
stream.close();
|
||||||
if (stream.bad()) {
|
if (stream.bad()) {
|
||||||
setError("Failed to save image. Disk full?");
|
setError("Failed to save image.\nDisk full?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize it.
|
// Resize it.
|
||||||
if (!resizeImage(mSavePath, mMaxWidth, mMaxHeight)) {
|
if (!resizeImage(mSavePath, mMaxWidth, mMaxHeight)) {
|
||||||
setError("Error saving resized image. Out of memory? Disk full?");
|
setError("Error saving resized image.\nOut of memory? Disk full?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue