Skip to content

Commit

Permalink
Also prevent use of std::filesystem in macOS 10.14
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Mar 28, 2024
1 parent 42504d0 commit f13a0fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/syncenginetestutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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
}
}

Expand Down
6 changes: 6 additions & 0 deletions test/testpermissions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() };
Expand Down Expand Up @@ -384,6 +387,7 @@ private slots:
QCOMPARE(count, 2);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
#endif

static void setAllPerm(FileInfo *fi, OCC::RemotePermissions perm)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f13a0fc

Please sign in to comment.