Skip to content

Commit 633ddad

Browse files
authored
Merge pull request #9067 from nextcloud/i2h3/fix/legacy-cleanup
File Provider Legacy Database Cleanup. This already passed except for unrelated Linux build tests.
2 parents ace2585 + e9f73dd commit 633ddad

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/gui/macOS/fileproviderdomainmanager_mac.mm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import <FileProvider/FileProvider.h>
99

10+
#include <QDir>
1011
#include <QLatin1StringView>
1112
#include <QLoggingCategory>
1213
#include <QUuid>
@@ -698,6 +699,34 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const
698699
removeFileProviderDomainForAccount(accountState.data());
699700
}
700701

702+
// If there are no enabled accounts, check for and remove the FileProviderExt directory
703+
// from the group container
704+
if (fileProviderEnabledAccountIds.isEmpty()) {
705+
const QString groupContainer = Mac::FileProviderUtils::groupContainerPath();
706+
707+
if (!groupContainer.isEmpty()) {
708+
QDir groupDir(groupContainer);
709+
const QString fileProviderExtDirName = QStringLiteral("FileProviderExt");
710+
711+
if (groupDir.exists(fileProviderExtDirName)) {
712+
const QString fileProviderExtPath = groupDir.absoluteFilePath(fileProviderExtDirName);
713+
QDir fileProviderExtDir(fileProviderExtPath);
714+
715+
qCInfo(lcMacFileProviderDomainManager) << "No file provider enabled accounts, removing FileProviderExt directory at:"
716+
<< fileProviderExtPath;
717+
718+
if (fileProviderExtDir.removeRecursively()) {
719+
qCInfo(lcMacFileProviderDomainManager) << "Successfully removed FileProviderExt directory in groun container.";
720+
} else {
721+
qCWarning(lcMacFileProviderDomainManager) << "Failed to remove FileProviderExt directory at:"
722+
<< fileProviderExtPath;
723+
}
724+
}
725+
} else {
726+
qCWarning(lcMacFileProviderDomainManager) << "Could not determine group container path!";
727+
}
728+
}
729+
701730
emit domainSetupComplete();
702731
}
703732

0 commit comments

Comments
 (0)