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