1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: common/stdpbase.cpp
3 // Purpose: wxStandardPathsBase methods common to all ports
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
32 #include "wx/apptrait.h"
34 #include "wx/filename.h"
35 #include "wx/stdpaths.h"
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 static wxStandardPaths gs_stdPaths;
43 // ============================================================================
45 // ============================================================================
48 wxStandardPathsBase& wxStandardPathsBase::Get()
50 wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
51 wxCHECK_MSG( traits, gs_stdPaths, _T("create wxApp before calling this") );
53 return traits->GetStandardPaths();
56 wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths()
61 wxStandardPathsBase::~wxStandardPathsBase()
66 wxString wxStandardPathsBase::GetLocalDataDir() const
71 wxString wxStandardPathsBase::GetUserLocalDataDir() const
73 return GetUserDataDir();
77 wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
81 // empty string indicates that an error has occurred, don't touch it then
82 if ( !subdir.empty() )
84 const wxString appname = wxTheApp->GetAppName();
85 if ( !appname.empty() )
87 const wxChar ch = *(subdir.end() - 1);
88 if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') )
89 subdir += wxFileName::GetPathSeparator();
98 #endif // wxUSE_STDPATHS