From af1191ab99889d21c42bb870535b96fb5ad1c9be Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 12 Oct 2014 20:48:36 +0000 Subject: [PATCH] Fall back to executable file name in wxApp::GetAppName(). This is especially useful when wxWidgets is used as part of another library and is not initialized with the real argc/argv containing the application name. Closes #16615. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/appbase.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 712d171f1c..b5852d45ee 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -45,6 +45,7 @@ #include "wx/sysopt.h" #include "wx/tokenzr.h" #include "wx/thread.h" +#include "wx/stdpaths.h" #if wxUSE_EXCEPTIONS // Do we have a C++ compiler with enough C++11 support for @@ -206,6 +207,16 @@ wxString wxAppConsoleBase::GetAppName() const // the application name is, by default, the name of its executable file wxFileName::SplitPath(argv[0], NULL, &name, NULL); } +#if wxUSE_STDPATHS + else // fall back to the executable file name, if we can determine it + { + const wxString pathExe = wxStandardPaths::Get().GetExecutablePath(); + if ( !pathExe.empty() ) + { + wxFileName::SplitPath(pathExe, NULL, &name, NULL); + } + } +#endif // wxUSE_STDPATHS } return name; }