Skip to content
Permalink
Browse files

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.
  • Loading branch information...
denisfa authored and rkitover committed Mar 19, 2019
1 parent a1f0c34 commit c714ff825a93cc1e5e76c6aaee76d0cb4f427601
Showing with 14 additions and 1 deletion.
  1. +12 −1 src/wx/wxvbam.cpp
  2. +2 −0 src/wx/wxvbam.h
@@ -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);
@@ -85,6 +85,7 @@ class wxvbamApp : public wxApp {
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 @@ class wxvbamApp : public wxApp {
protected:
bool using_wayland;
bool console_mode = false;
int console_status = 0;

private:
wxPathList config_path;

0 comments on commit c714ff8

Please sign in to comment.
You can’t perform that action at this time.