don't use wxApp::GetAppName() in the usage message, we want the real argv[0] here

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-08-16 10:08:04 +00:00
parent 442a79c0b4
commit a2ec9439a3

View File

@ -38,13 +38,13 @@
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/filefn.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include <ctype.h> #include <ctype.h>
#include "wx/datetime.h" #include "wx/datetime.h"
#include "wx/msgout.h" #include "wx/msgout.h"
#include "wx/filename.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private functions // private functions
@ -245,7 +245,7 @@ void wxCmdLineParserData::SetArguments(const wxString& cmdLine)
{ {
m_arguments.clear(); m_arguments.clear();
m_arguments.push_back(wxTheApp->GetAppName()); m_arguments.push_back(wxTheApp ? wxTheApp->argv[0] : _T(""));
wxArrayString args = wxCmdLineParser::ConvertStringToArgs(cmdLine); wxArrayString args = wxCmdLineParser::ConvertStringToArgs(cmdLine);
@ -929,14 +929,15 @@ void wxCmdLineParser::Usage()
wxString wxCmdLineParser::GetUsageString() wxString wxCmdLineParser::GetUsageString()
{ {
wxString appname = wxTheApp->GetAppName(); wxString appname;
if ( !appname ) if ( m_data->m_arguments.empty() )
{ {
wxCHECK_MSG( m_data->m_arguments.size() != 0, wxEmptyString, if ( wxTheApp )
_T("no program name") ); appname = wxTheApp->GetAppName();
}
appname = wxFileNameFromPath(m_data->m_arguments[0]); else // use argv[0]
wxStripExtension(appname); {
appname = wxFileName(m_data->m_arguments[0]).GetName();
} }
// we construct the brief cmd line desc on the fly, but not the detailed // we construct the brief cmd line desc on the fly, but not the detailed