]> git.saurik.com Git - wxWidgets.git/blame - src/common/stdpbase.cpp
Fix eval order of arguments...
[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
ce336c6d
VZ
27#ifndef WX_PRECOMP
28 #include "wx/app.h"
29#endif //WX_PRECOMP
fc480dc1 30#include "wx/apptrait.h"
ce336c6d
VZ
31
32#include "wx/filename.h"
6cb5e50b
VZ
33#include "wx/stdpaths.h"
34
35// ----------------------------------------------------------------------------
36// module globals
37// ----------------------------------------------------------------------------
38
39static wxStandardPaths gs_stdPaths;
40
41// ============================================================================
42// implementation
43// ============================================================================
44
45/* static */
fc480dc1
DE
46wxStandardPathsBase& wxStandardPathsBase::Get()
47{
48 return wxTheApp->GetTraits()->GetStandardPaths();
49}
50
51wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths()
6cb5e50b
VZ
52{
53 return gs_stdPaths;
54}
55
56wxStandardPathsBase::~wxStandardPathsBase()
57{
58 // nothing to do here
59}
60
61wxString wxStandardPathsBase::GetLocalDataDir() const
62{
63 return GetDataDir();
64}
65
66wxString wxStandardPathsBase::GetUserLocalDataDir() const
67{
68 return GetUserDataDir();
69}
70
ce336c6d
VZ
71/* static */
72wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
73{
74 wxString subdir(dir);
75
76 // empty string indicates that an error has occured, don't touch it then
77 if ( !subdir.empty() )
78 {
79 const wxString appname = wxTheApp->GetAppName();
80 if ( !appname.empty() )
81 {
82 const wxChar ch = *(subdir.end() - 1);
83 if ( !wxFileName::IsPathSeparator(ch) && ch != _T('.') )
84 subdir += wxFileName::GetPathSeparator();
85
86 subdir += appname;
87 }
88 }
89
90 return subdir;
91}
92