From 52c7a6a181e0028e318b8ce6433fb577f7bbecad Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:14:24 -0400 Subject: added directory checks for desktop and onedrive --- src/sanitychecks.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/sanitychecks.cpp') 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> getSystemDirectories() { // folder ids and display names for logging const std::vector> 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> 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); -- cgit v1.3.1