mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Use QSaveFile wherever applicable
expected.hpp was fetched from:
b803e3c07b/include/nonstd/expected.hpp
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include "base/rss/rss_session.h"
|
||||
#include "base/utils/compare.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "gui/autoexpandabledialog.h"
|
||||
#include "gui/torrentcategorydialog.h"
|
||||
@@ -452,12 +453,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(rules) != rules.length()))
|
||||
const QByteArray rules = RSS::AutoDownloader::instance()->exportRules(format);
|
||||
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(path, rules);
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(this, tr("I/O Error")
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(file.errorString()));
|
||||
, tr("Failed to create the destination file. Reason: %1").arg(result.error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user