]> git.saurik.com Git - wxWidgets.git/commitdiff
don't use wxApp::GetAppName() in the usage message, we want the real argv[0] here
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Aug 2005 10:08:04 +0000 (10:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Aug 2005 10:08:04 +0000 (10:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cmdline.cpp

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