Options::Init(m_pOptions.get()); // Implementation in OptionsInit.cpp
ApplyCommandLineConfigOptions(cmdInfo);
+ if (cmdInfo.m_sErrorMessages.size() > 0)
+ {
+ if (AttachConsole(static_cast<DWORD>(-1)))
+ {
+ DWORD dwWritten;
+ for (auto& msg : cmdInfo.m_sErrorMessages)
+ {
+ String line = _T("WinMerge: ") + msg + _T("\n");
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), line.c_str(), static_cast<DWORD>(line.length()), &dwWritten, NULL);
+ }
+ FreeConsole();
+ }
+ }
// Initialize temp folder
SetupTempPath();
}
else
{
- String msg = strutils::format_string1(_T("WinMerge: Invalid key '%1' specified in /config option\n"), it.first);
- if (AttachConsole(static_cast<DWORD>(-1)))
- {
- DWORD dwWritten;
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), msg.c_str(), static_cast<DWORD>(msg.length()), &dwWritten, NULL);
- FreeConsole();
- }
+ cmdInfo.m_sErrorMessages.push_back(strutils::format_string1(_T("Invalid key '%1' specified in /config option"), it.first));
}
}
}
{
q = SetConfig(q);
}
+ else
+ {
+ m_sErrorMessages.push_back(_T("Unknown option '/") + param + _T("'"));
+ }
}
// If "compare file dir" make it "compare file dir\file".
if (m_Files.GetSize() >= 2)
std::map<String, String> m_Options;
+ std::vector<String> m_sErrorMessages;
+
private:
static const TCHAR *EatParam(const TCHAR *, String &, bool *flag = 0);