From a5db7ed864ac58657bf9bfbbc292cdccbeeaa38b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 19 Sep 2019 11:23:21 -0400 Subject: added Settings::isExecutableBlacklisted() moved blacklisted confirmation to dialogs --- src/spawn.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/spawn.cpp') diff --git a/src/spawn.cpp b/src/spawn.cpp index c9025d98..45324d79 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -345,6 +345,20 @@ bool eventLogNotRunning( return (r != QDialogButtonBox::No); } +bool confirmBlacklisted(QWidget* parent, const SpawnParameters& sp) +{ + const auto r = QuestionBoxMemory::query( + parent, QString("blacklistedExecutable"), sp.binary.fileName(), + QObject::tr("Blacklisted Executable"), + QObject::tr("The executable you are attempted to launch is blacklisted in the virtual file" + " system. This will likely prevent the executable, and any executables that are" + " launched by this one, from seeing any mods. This could extend to INI files, save" + " games and any other virtualized files.\n\nContinue launching %1?").arg(sp.binary.fileName()), + QDialogButtonBox::Yes | QDialogButtonBox::No); + + return (r != QDialogButtonBox::No); +} + } // namespace @@ -652,18 +666,8 @@ bool checkEnvironment(QWidget* parent, const SpawnParameters& sp) bool checkBlacklist(QWidget* parent, const SpawnParameters& sp, const Settings& settings) { - for (auto exec : settings.executablesBlacklist().split(";")) { - if (exec.compare(sp.binary.fileName(), Qt::CaseInsensitive) == 0) { - if (QuestionBoxMemory::query(parent, QString("blacklistedExecutable"), sp.binary.fileName(), - QObject::tr("Blacklisted Executable"), - QObject::tr("The executable you are attempted to launch is blacklisted in the virtual file" - " system. This will likely prevent the executable, and any executables that are" - " launched by this one, from seeing any mods. This could extend to INI files, save" - " games and any other virtualized files.\n\nContinue launching %1?").arg(sp.binary.fileName()), - QDialogButtonBox::Yes | QDialogButtonBox::No) == QDialogButtonBox::No) { - return false; - } - } + if (settings.isExecutableBlacklisted(sp.binary.fileName())) { + return dialogs::confirmBlacklisted(parent, sp); } return true; @@ -779,7 +783,6 @@ bool backdateBSAs(const std::wstring &moPath, const std::wstring &dataPath) return helperExec(moPath, commandLine, FALSE); } - bool adminLaunch(const std::wstring &moPath, const std::wstring &moFile, const std::wstring &workingDir) { const std::wstring commandLine = fmt::format( -- cgit v1.3.1