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

Function getAssociation

src/env.cpp:763–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763Association getAssociation(const QFileInfo& targetInfo)
764{
765 log::debug("getting association for '{}', extension is '.{}'",
766 targetInfo.absoluteFilePath(), targetInfo.suffix());
767
768 const auto cmd = getAssocString(targetInfo, ASSOCSTR_COMMAND);
769 if (!cmd) {
770 return {};
771 }
772
773 log::debug("raw cmd is '{}'", *cmd);
774
775 QString formattedCmd = formatCommandLine(targetInfo, *cmd);
776 if (formattedCmd.isEmpty()) {
777 log::error("command line associated with '{}' is empty",
778 targetInfo.absoluteFilePath());
779
780 return {};
781 }
782
783 log::debug("formatted cmd is '{}'", formattedCmd);
784
785 const auto p = splitExeAndArguments(formattedCmd);
786 if (p.first.isEmpty()) {
787 return {};
788 }
789
790 log::debug("split into exe='{}' and cmd='{}'", p.first, p.second);
791
792 return {QFileInfo(p.first), *cmd, p.second};
793}
794
795struct RegistryKeyCloser
796{

Callers 1

runMethod · 0.85

Calls 4

getAssocStringFunction · 0.85
formatCommandLineFunction · 0.85
splitExeAndArgumentsFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected