diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-17 09:14:24 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-17 09:14:24 -0400 |
| commit | 52c7a6a181e0028e318b8ce6433fb577f7bbecad (patch) | |
| tree | c2a1d4d2d2424d24332f007616ce98f98d8602be /src/sanitychecks.cpp | |
| parent | 3b0fbebc6ad8979d9d4551fcd9db1b8f2ca4bf48 (diff) | |
added directory checks for desktop and onedrive
Diffstat (limited to 'src/sanitychecks.cpp')
| -rw-r--r-- | src/sanitychecks.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 6da42e79..3372f81c 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -268,28 +268,23 @@ std::vector<std::pair<QString, QString>> getSystemDirectories() { // folder ids and display names for logging const std::vector<std::pair<GUID, QString>> systemFolderIDs = { - {FOLDERID_ProgramFiles, "Program Files"}, - {FOLDERID_ProgramFilesX86, "Program Files"} + {FOLDERID_ProgramFiles, "in program files"}, + {FOLDERID_ProgramFilesX86, "in program files"}, + {FOLDERID_Desktop, "on the desktop"}, + {FOLDERID_OneDrive, "in OneDrive"} }; std::vector<std::pair<QString, QString>> systemDirs; for (auto&& p : systemFolderIDs) { - try - { - const auto dir = MOBase::getKnownFolder(p.first); - - auto path = QDir::toNativeSeparators(dir.absolutePath()).toLower(); + if (const auto dir=MOBase::getOptionalKnownFolder(p.first)) { + auto path = QDir::toNativeSeparators(dir->absolutePath()).toLower(); if (!path.endsWith("\\")) { path += "\\"; } systemDirs.push_back({path, p.second}); } - catch(std::exception&) - { - // ignore - } } return systemDirs; @@ -306,7 +301,7 @@ int checkProtected(const QDir& d, const QString& what) for (auto&& sd : systemDirs) { if (path.startsWith(sd.first)) { log::warn( - "{} is in {}; this may cause issues because it's a protected " + "{} is {}; this may cause issues because it's a special " "system folder", what, sd.second); |
