]> git.saurik.com Git - wxWidgets.git/blame - src/common/stdpbase.cpp
fix Borland bug http://news.gmane.org/find-root.php?message_id=%3c43A0B07F.8010204...
[wxWidgets.git] / src / common / stdpbase.cpp
CommitLineData
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
07158944
VZ
27#if wxUSE_STDPATHS
28
ce336c6d
VZ
29#ifndef WX_PRECOMP
30 #include "wx/app.h"
31#endif //WX_PRECOMP
fc480dc1 32#include "wx/apptrait.h"
ce336c6d
VZ
33
34#include "wx/filename.h"
6cb5e50b
VZ
35#include "wx/stdpaths.h"
36
37// ----------------------------------------------------------------------------
38// module globals
39// ----------------------------------------------------------------------------
40
41static wxStandardPaths gs_stdPaths;
42
43// ============================================================================
44// implementation
45// ============================================================================
46
47/* static */
fc480dc1
DE
48wxStandardPathsBase& wxStandardPathsBase::Get()
49{
81f9c575
VZ
50 wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
51 wxCHECK_MSG( traits, gs_stdPaths, _T("create wxApp before calling this") );
52
53 return traits->GetStandardPaths();
fc480dc1
DE
54}
55
56wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths()
6cb5e50b
VZ
57{
58 return gs_stdPaths;
59}
60
61wxStandardPathsBase::~wxStandardPathsBase()
62{
63 // nothing to do here
64}
65
66wxString wxStandardPathsBase::GetLocalDataDir() const
67{
68 return GetDataDir();
69}
70
71wxString wxStandardPathsBase::GetUserLocalDataDir() const
72{
73 return GetUserDataDir();
74}
75
ce336c6d
VZ
76/* static */
77wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
78{
79 wxString subdir(dir);
80
3103e8a9 81 // empty string indicates that an error has occurred, don't touch it then
ce336c6d
VZ
82 if ( !subdir.empty() )
83 {
84 const wxString appname = wxTheApp->GetAppName();
85 if ( !appname.empty() )
86 {
87 const wxChar ch = *(subdir.end() - 1);
88 if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') )
89 subdir += wxFileName::GetPathSeparator();
90
91 subdir += appname;
92 }
93 }
94
95 return subdir;
96}
97
07158944 98#endif // wxUSE_STDPATHS