Fix build with std::filesystem

Use cxx17_filesystem config instead of Q_OS_INTEGRITY.

Change-Id: I1d3fdae449a534dd25a32ce2820a4ebf788de2b0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
This commit is contained in:
Antti Määttä 2023-11-13 11:49:34 +02:00
parent 48080c2327
commit d61cee0ed8
2 changed files with 9 additions and 4 deletions

View File

@ -25,3 +25,8 @@ qt_internal_extend_target(QCtfTracePlugin CONDITION QT_FEATURE_zstd
LIBRARIES
WrapZSTD::WrapZSTD
)
qt_internal_extend_target(QCtfTracePlugin CONDITION (QT_FEATURE_cxx17_filesystem) AND (GCC AND (QMAKE_GCC_MAJOR_VERSION LESS 9))
LINK_OPTIONS
"-lstdc++fs"
)

View File

@ -15,7 +15,7 @@
#include <qplatformdefs.h>
#include "qctflib_p.h"
#ifndef Q_OS_INTEGRITY
#if QT_CONFIG(cxx17_filesystem)
#include <filesystem>
#endif
@ -121,7 +121,7 @@ QCtfLibImpl::QCtfLibImpl()
m_session.tracepoints.append(allLiteral());
m_session.name = defaultLiteral();
} else {
#ifdef Q_OS_INTEGRITY
#if !QT_CONFIG(cxx17_filesystem)
qCWarning(lcDebugTrace) << "Unable to use filesystem";
return;
#endif
@ -168,7 +168,7 @@ QCtfLibImpl::QCtfLibImpl()
m_session.name = defaultLiteral();
}
m_location = location + u"/ust";
#ifndef Q_OS_INTEGRITY
#if QT_CONFIG(cxx17_filesystem)
std::filesystem::create_directory(qPrintable(m_location), qPrintable(location));
#endif
}
@ -185,7 +185,7 @@ QCtfLibImpl::QCtfLibImpl()
void QCtfLibImpl::clearLocation()
{
#ifndef Q_OS_INTEGRITY
#if QT_CONFIG(cxx17_filesystem)
const std::filesystem::path location{qUtf16Printable(m_location)};
for (auto const& dirEntry : std::filesystem::directory_iterator{location})
{