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();
76 wxString
wxStandardPathsBase::GetDocumentsDir() const
78 return wxFileName::GetHomeDir();
82 wxString
wxStandardPathsBase::AppendAppName(const wxString
& dir
)
86 // empty string indicates that an error has occurred, don't touch it then
87 if ( !subdir
.empty() )
89 const wxString appname
= wxTheApp
->GetAppName();
90 if ( !appname
.empty() )
92 const wxChar ch
= *(subdir
.end() - 1);
93 if ( !wxFileName::IsPathSeparator(ch
) && ch
!= _T('.') )
94 subdir
+= wxFileName::GetPathSeparator();
103 #endif // wxUSE_STDPATHS