MCPcopy Create free account
hub / github.com/WinMerge/winmerge / FormatCmdLine

Function FormatCmdLine

ShellExtension/Common/WinMergeContextMenu.cpp:61–89  ·  view source on GitHub ↗

Format commandline used to start WinMerge

Source from the content-addressed store, hash-verified

59
60/// Format commandline used to start WinMerge
61static String FormatCmdLine(DWORD verb, const String &winmergePath,
62 const std::vector<String>& paths, BOOL bAlterSubFolders)
63{
64 String strCommandline = winmergePath.empty() ? _T("") : _T("\"") + winmergePath + _T("\"");
65
66 // Check if user wants to use context menu
67 BOOL bSubfoldersByDefault = FALSE;
68 CRegKeyEx reg;
69 if (reg.Open(HKEY_CURRENT_USER, f_RegSettingsDir) == ERROR_SUCCESS)
70 bSubfoldersByDefault = reg.ReadBool(f_Recurse, FALSE);
71
72 if (bAlterSubFolders && !bSubfoldersByDefault)
73 strCommandline += _T(" /r");
74 else if (!bAlterSubFolders && bSubfoldersByDefault)
75 strCommandline += _T(" /r");
76
77 strCommandline += _T(" \"") + paths[0] + _T("\"");
78
79 if (paths.size() > 1)
80 strCommandline += _T(" \"") + paths[1] + _T("\"");
81
82 if (paths.size() > 2)
83 strCommandline += _T(" \"") + paths[2] + _T("\"");
84
85 if (verb == WinMergeContextMenu::CMD_COMPARE_AS)
86 strCommandline += _T(" /show-compare-as-menu");
87
88 return strCommandline;
89}
90
91// https://devblogs.microsoft.com/oldnewthing/20130318-00/?p=4933
92static HRESULT FindDesktopFolderView(REFIID riid, void** ppv)

Callers 1

LaunchWinMergeFunction · 0.85

Calls 4

emptyMethod · 0.45
OpenMethod · 0.45
ReadBoolMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected