moved AppendAppName() from MSW to common code; modified it to not double the trailing slash, if any
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,6 +24,11 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/filename.h"
|
||||
#include "wx/stdpaths.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -57,3 +62,25 @@ wxString wxStandardPathsBase::GetUserLocalDataDir() const
|
||||
return GetUserDataDir();
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
|
||||
{
|
||||
wxString subdir(dir);
|
||||
|
||||
// empty string indicates that an error has occured, don't touch it then
|
||||
if ( !subdir.empty() )
|
||||
{
|
||||
const wxString appname = wxTheApp->GetAppName();
|
||||
if ( !appname.empty() )
|
||||
{
|
||||
const wxChar ch = *(subdir.end() - 1);
|
||||
if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') )
|
||||
subdir += wxFileName::GetPathSeparator();
|
||||
|
||||
subdir += appname;
|
||||
}
|
||||
}
|
||||
|
||||
return subdir;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user