|
7 | 7 |
|
8 | 8 | #import <FileProvider/FileProvider.h> |
9 | 9 |
|
| 10 | +#include <QDir> |
10 | 11 | #include <QLatin1StringView> |
11 | 12 | #include <QLoggingCategory> |
12 | 13 | #include <QUuid> |
@@ -698,6 +699,34 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const |
698 | 699 | removeFileProviderDomainForAccount(accountState.data()); |
699 | 700 | } |
700 | 701 |
|
| 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 | + |
701 | 730 | emit domainSetupComplete(); |
702 | 731 | } |
703 | 732 |
|
|
0 commit comments