- wxString brief, detailed;
- brief.Printf(_("Usage: %s"), wxTheApp->GetAppName().c_str());
+ wxString appname = wxTheApp->GetAppName();
+ if ( !appname )
+ {
+ wxCHECK_RET( !m_data->m_arguments.IsEmpty(), _T("no program name") );
+
+ appname = wxFileNameFromPath(m_data->m_arguments[0]);
+ wxStripExtension(appname);
+ }
+
+ // we construct the brief cmd line desc on the fly, but not the detailed
+ // help message below because we want to align the options descriptions
+ // and for this we must first know the longest one of them
+ wxString brief;
+ wxArrayString namesOptions, descOptions;
+ brief.Printf(_("Usage: %s"), appname.c_str());
+
+ // the switch char is usually '-' but this can be changed with
+ // SetSwitchChars() and then the first one of possible chars is used
+ wxChar chSwitch = !m_data->m_switchChars ? _T('-')
+ : m_data->m_switchChars[0u];