| 761 | } |
| 762 | |
| 763 | Association 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 | |
| 795 | struct RegistryKeyCloser |
| 796 | { |
no test coverage detected