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

Method run

src/processrunner.cpp:689–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689ProcessRunner::Results ProcessRunner::run()
690{
691 // check if setHooked() was called after setFromFile(); this needs to
692 // modify the settings to run the associated executable instead of using
693 // shell::Open()
694
695 if (shouldRunShell() && m_sp.hooked) {
696 // this is a non-executable file, but it should be hooked; the associated
697 // executable needs to be retrieved and run instead
698 auto assoc = env::getAssociation(m_shellOpen);
699 if (!assoc.executable.filePath().isEmpty()) {
700 setBinary(assoc.executable);
701 setArguments(assoc.formattedCommandLine);
702 setCurrentDirectory(assoc.executable.absoluteDir());
703 m_shellOpen = {};
704 } else {
705 // if it fails, just use the regular shell open
706 log::error("failed to get the associated executable, running unhooked");
707 m_sp.hooked = false;
708 }
709 } else if (!shouldRunShell() && !m_sp.hooked) {
710 // this is an executable that should not be hooked; just run it through
711 // the shell
712 m_shellOpen = m_sp.binary;
713 }
714
715 std::optional<Results> r;
716
717 if (shouldRunShell()) {
718 r = runShell();
719 } else {
720 r = runBinary();
721 }
722
723 if (r) {
724 // early result: something went wrong and the process cannot be waited for
725 return *r;
726 }
727
728 return postRun();
729}
730
731std::optional<ProcessRunner::Results> ProcessRunner::runShell()
732{

Callers 11

startExeActionMethod · 0.45
startApplicationMethod · 0.45
openMethod · 0.45
openHookedMethod · 0.45
onOpenMethod · 0.45
onRunHookedMethod · 0.45
runFunction · 0.45
openItemMethod · 0.45
processMethod · 0.45
runPostOrganizerMethod · 0.45

Calls 2

getAssociationFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected