mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Fix build with Clang on Windows
This commit is contained in:
@@ -71,6 +71,16 @@ namespace BlackMisc
|
||||
return ok;
|
||||
}
|
||||
|
||||
CAtomicFile::~CAtomicFile()
|
||||
{
|
||||
#if __cplusplus >= 201700L
|
||||
const bool ex = std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
const bool ex = std::uncaught_exception();
|
||||
#endif
|
||||
if (ex) { QFile::close(); }
|
||||
}
|
||||
|
||||
void CAtomicFile::close()
|
||||
{
|
||||
if (! isOpen()) { return; }
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
||||
CAtomicFile(const QString &filename) : QFile(filename) {}
|
||||
|
||||
//! \copydoc QFile::~QFile
|
||||
virtual ~CAtomicFile() override { if (std::uncaught_exception()) { QFile::close(); } }
|
||||
virtual ~CAtomicFile() override;
|
||||
|
||||
//! \copydoc QFile::open
|
||||
//! Just before opening the file, the filename is changed so we actually write to a temporary file.
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace BlackMisc
|
||||
QFileInfoList result = dir.entryInfoList(nameFilters, QDir::Files);
|
||||
if (predicate)
|
||||
{
|
||||
result.erase(std::remove_if(result.begin(), result.end(), std::not1(predicate)), result.end());
|
||||
result.erase(std::remove_if(result.begin(), result.end(), [ = ](const auto &f) { return !predicate(f); }), result.end());
|
||||
}
|
||||
if (recursive)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "blackmisc/processctrl.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <array>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
||||
QString command = '"' % QString(program).replace('/', '\\') % '"';
|
||||
if (!arguments.isEmpty())
|
||||
{
|
||||
command += " \"" % arguments.join('" "').replace('/', '\\') % '"';
|
||||
command += " \"" % arguments.join("\" \"").replace('/', '\\') % '"';
|
||||
}
|
||||
|
||||
DWORD flags = 0;
|
||||
|
||||
@@ -571,7 +571,12 @@ namespace BlackMisc
|
||||
{
|
||||
if (m_page)
|
||||
{
|
||||
if (std::uncaught_exception()) { m_page->abandonBatch(); }
|
||||
#if __cplusplus >= 201700L
|
||||
const bool ex = std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
const bool ex = std::uncaught_exception();
|
||||
#endif
|
||||
if (ex) { m_page->abandonBatch(); }
|
||||
else { m_page->endBatch(); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user