[ 1590221 ] wxStandardPaths::GetExecutablePath
Required for optimised stackwalker patch. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,6 +53,27 @@ wxStandardPathsBase& wxStandardPathsBase::Get()
|
||||
return traits->GetStandardPaths();
|
||||
}
|
||||
|
||||
wxString wxStandardPathsBase::GetExecutablePath() const
|
||||
{
|
||||
if ( !wxTheApp || !wxTheApp->argv )
|
||||
return wxEmptyString;
|
||||
|
||||
wxString argv0 = wxTheApp->argv[0];
|
||||
if (wxIsAbsolutePath(argv0))
|
||||
return argv0;
|
||||
|
||||
// Search PATH.environment variable...
|
||||
wxPathList pathlist;
|
||||
pathlist.AddEnvList(wxT("PATH"));
|
||||
wxString path = pathlist.FindAbsoluteValidPath(argv0);
|
||||
if ( path.empty() )
|
||||
return argv0; // better than nothing
|
||||
|
||||
wxFileName filename(path);
|
||||
filename.Normalize();
|
||||
return filename.GetFullPath();
|
||||
}
|
||||
|
||||
wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths()
|
||||
{
|
||||
return gs_stdPaths;
|
||||
|
||||
Reference in New Issue
Block a user