]>
Commit | Line | Data |
---|---|---|
6cb5e50b VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: common/stdpbase.cpp | |
3 | // Purpose: wxStandardPathsBase methods common to all ports | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 2004-10-19 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> | |
9 | // License: wxWindows license | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // for compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
ce336c6d VZ |
27 | #ifndef WX_PRECOMP |
28 | #include "wx/app.h" | |
29 | #endif //WX_PRECOMP | |
30 | ||
31 | #include "wx/filename.h" | |
6cb5e50b VZ |
32 | #include "wx/stdpaths.h" |
33 | ||
34 | // ---------------------------------------------------------------------------- | |
35 | // module globals | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
38 | static wxStandardPaths gs_stdPaths; | |
39 | ||
40 | // ============================================================================ | |
41 | // implementation | |
42 | // ============================================================================ | |
43 | ||
44 | /* static */ | |
45 | wxStandardPaths& wxStandardPathsBase::Get() | |
46 | { | |
47 | return gs_stdPaths; | |
48 | } | |
49 | ||
50 | wxStandardPathsBase::~wxStandardPathsBase() | |
51 | { | |
52 | // nothing to do here | |
53 | } | |
54 | ||
55 | wxString wxStandardPathsBase::GetLocalDataDir() const | |
56 | { | |
57 | return GetDataDir(); | |
58 | } | |
59 | ||
60 | wxString wxStandardPathsBase::GetUserLocalDataDir() const | |
61 | { | |
62 | return GetUserDataDir(); | |
63 | } | |
64 | ||
ce336c6d VZ |
65 | /* static */ |
66 | wxString wxStandardPathsBase::AppendAppName(const wxString& dir) | |
67 | { | |
68 | wxString subdir(dir); | |
69 | ||
70 | // empty string indicates that an error has occured, don't touch it then | |
71 | if ( !subdir.empty() ) | |
72 | { | |
73 | const wxString appname = wxTheApp->GetAppName(); | |
74 | if ( !appname.empty() ) | |
75 | { | |
76 | const wxChar ch = *(subdir.end() - 1); | |
77 | if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') ) | |
78 | subdir += wxFileName::GetPathSeparator(); | |
79 | ||
80 | subdir += appname; | |
81 | } | |
82 | } | |
83 | ||
84 | return subdir; | |
85 | } | |
86 |