fix problems of command line parameters

* Fix return code for wrong command line parameters.

* Update return code for incorrect command line option on WX port.
This commit is contained in:
Edênis Freindorfer Azevedo 2019-03-19 00:38:42 -03:00 committed by Rafael Kitover
parent a1f0c34ace
commit c714ff825a
2 changed files with 14 additions and 1 deletions

View File

@ -206,6 +206,9 @@ bool wxvbamApp::OnInit()
if (!wxApp::OnInit())
return false;
if (console_mode)
return true;
// prepare for loading xrc files
wxXmlResource* xr = wxXmlResource::Get();
// note: if linking statically, next 2 pull in lot of unused code
@ -426,7 +429,7 @@ int wxvbamApp::OnRun()
if (console_mode)
{
// we could check for our own error codes here...
return EXIT_SUCCESS;
return console_status;
}
else
{
@ -441,6 +444,14 @@ bool wxvbamApp::OnCmdLineHelp(wxCmdLineParser& parser)
return true;
}
bool wxvbamApp::OnCmdLineError(wxCmdLineParser& parser)
{
wxApp::OnCmdLineError(parser);
console_mode = true;
console_status = 1;
return true;
}
void wxvbamApp::OnInitCmdLine(wxCmdLineParser& cl)
{
wxApp::OnInitCmdLine(cl);

View File

@ -85,6 +85,7 @@ public:
virtual bool OnInit();
virtual int OnRun();
virtual bool OnCmdLineHelp(wxCmdLineParser&);
virtual bool OnCmdLineError(wxCmdLineParser&);
virtual bool UsingWayland() { return using_wayland; }
virtual void OnInitCmdLine(wxCmdLineParser&);
virtual bool OnCmdLineParsed(wxCmdLineParser&);
@ -145,6 +146,7 @@ public:
protected:
bool using_wayland;
bool console_mode = false;
int console_status = 0;
private:
wxPathList config_path;