mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 08:43:08 -07:00
Use QSaveFile wherever applicable
expected.hpp was fetched from:
b803e3c07b/include/nonstd/expected.hpp
This commit is contained in:
parent
81139c0098
commit
21f72baae2
17 changed files with 2597 additions and 88 deletions
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/gzip.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
const int MAX_REDIRECTIONS = 20; // the common value for web browsers
|
||||
|
@ -43,12 +44,7 @@ namespace
|
|||
bool saveToFile(const QByteArray &replyData, QString &filePath)
|
||||
{
|
||||
if (!filePath.isEmpty())
|
||||
{
|
||||
QFile file {filePath};
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
return false;
|
||||
return (file.write(replyData) == replyData.length());
|
||||
}
|
||||
return Utils::IO::saveToFile(filePath, replyData).has_value();
|
||||
|
||||
QTemporaryFile tmpfile {Utils::Fs::tempPath() + "XXXXXX"};
|
||||
tmpfile.setAutoRemove(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue