mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-08 06:00:59 -07:00
Improve error detection when saving files
This commit is contained in:
parent
6a6268c068
commit
81139c0098
5 changed files with 21 additions and 23 deletions
|
@ -452,13 +452,12 @@ void AutomatedRssDownloader::on_exportBtn_clicked()
|
|||
path += EXT_LEGACY;
|
||||
}
|
||||
|
||||
const QByteArray rules {RSS::AutoDownloader::instance()->exportRules(format)};
|
||||
QFile file {path};
|
||||
if (!file.open(QFile::WriteOnly)
|
||||
|| (file.write(RSS::AutoDownloader::instance()->exportRules(format)) == -1))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this, tr("I/O Error")
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(file.errorString()));
|
||||
if (!file.open(QFile::WriteOnly) || (file.write(rules) != rules.length()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("I/O Error")
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(file.errorString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue