MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / runBinary

Method runBinary

src/processrunner.cpp:756–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756std::optional<ProcessRunner::Results> ProcessRunner::runBinary()
757{
758 if (m_profileName.isEmpty()) {
759 // get the current profile name if it wasn't overridden
760 const auto* profile = m_core.currentProfile();
761 if (!profile) {
762 throw MyException(QObject::tr("No profile set"));
763 }
764
765 m_profileName = profile->name();
766 }
767
768 // saves profile, sets up usvfs, notifies plugins, etc.; can return false if
769 // a plugin doesn't want the program to run (such as when checkFNIS fails to
770 // run FNIS and the user clicks cancel)
771 if (!m_core.beforeRun(m_sp.binary, m_sp.currentDirectory, m_sp.arguments,
772 m_profileName, m_customOverwrite, m_forcedLibraries)) {
773 return Error;
774 }
775
776 // parent widget used for any dialog popped up while checking for things
777 QWidget* parent = (m_ui ? m_ui->mainWindow() : nullptr);
778
779 const auto* game = m_core.managedGame();
780 auto& settings = m_core.settings();
781
782 // start steam if needed
783 if (!checkSteam(parent, m_sp, game->gameDirectory(), m_sp.steamAppID, settings)) {
784 return Error;
785 }
786
787 // warn if the executable is on the blacklist
788 if (!checkBlacklist(parent, m_sp, settings)) {
789 return Error;
790 }
791
792 // if the executable is inside the mods folder another instance of
793 // ModOrganizer.exe is spawned instead to launch it
794 adjustForVirtualized(game, m_sp, settings);
795
796 // run the binary
797 m_handle.reset(startBinary(parent, m_sp));
798 if (m_handle.get() == INVALID_HANDLE_VALUE) {
799 return Error;
800 }
801
802 return {};
803}
804
805bool ProcessRunner::shouldRefresh(Results r) const
806{

Callers

nothing calls this directly

Calls 14

checkSteamFunction · 0.85
checkBlacklistFunction · 0.85
adjustForVirtualizedFunction · 0.85
startBinaryFunction · 0.85
currentProfileMethod · 0.80
beforeRunMethod · 0.80
mainWindowMethod · 0.80
gameDirectoryMethod · 0.80
isEmptyMethod · 0.45
nameMethod · 0.45
managedGameMethod · 0.45
settingsMethod · 0.45

Tested by

no test coverage detected