Also prevent use of std::filesystem in macOS 10.14

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-03-28 18:21:19 +08:00 committed by Claudio Cambra
parent 42504d0a0f
commit f13a0fc732
2 changed files with 10 additions and 0 deletions

View File

@ -17,7 +17,9 @@
#include <QJsonValue>
#include <memory>
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
#include <filesystem>
#endif
PathComponents::PathComponents(const char *path)
: PathComponents { QString::fromUtf8(path) }
@ -50,9 +52,11 @@ void DiskFileModifier::remove(const QString &relativePath)
if (fi.isFile()) {
QVERIFY(_rootDir.remove(relativePath));
} else {
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
const auto pathToDelete = fi.filePath().toStdWString();
std::filesystem::permissions(pathToDelete, std::filesystem::perms::owner_exec, std::filesystem::perm_options::add);
QVERIFY(std::filesystem::remove_all(pathToDelete));
#endif
}
}

View File

@ -11,7 +11,9 @@
#include <QtTest>
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
#include <filesystem>
#endif
#include <iostream>
using namespace OCC;
@ -77,6 +79,7 @@ private slots:
Logger::instance()->setLogDebug(true);
}
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
void t7pl()
{
FakeFolder fakeFolder{ FileInfo() };
@ -384,6 +387,7 @@ private slots:
QCOMPARE(count, 2);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
#endif
static void setAllPerm(FileInfo *fi, OCC::RemotePermissions perm)
{
@ -592,6 +596,7 @@ private slots:
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
static void demo_perms(std::filesystem::perms p)
{
using std::filesystem::perms;
@ -741,6 +746,7 @@ private slots:
QVERIFY(testFolderStatus.permissions() & std::filesystem::perms::owner_read);
QVERIFY(!static_cast<bool>(testFolderStatus.permissions() & std::filesystem::perms::owner_write));
}
#endif
};
QTEST_GUILESS_MAIN(TestPermissions)