]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/stdpbase.cpp
fixes for animated GIFs playing (patch 1097003)
[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#ifndef WX_PRECOMP
28 #include "wx/app.h"
29#endif //WX_PRECOMP
30#include "wx/apptrait.h"
31
32#include "wx/filename.h"
33#include "wx/stdpaths.h"
34
35// ----------------------------------------------------------------------------
36// module globals
37// ----------------------------------------------------------------------------
38
39static wxStandardPaths gs_stdPaths;
40
41// ============================================================================
42// implementation
43// ============================================================================
44
45/* static */
46wxStandardPathsBase& wxStandardPathsBase::Get()
47{
48 return wxTheApp->GetTraits()->GetStandardPaths();
49}
50
51wxStandardPathsBase& wxAppTraitsBase::GetStandardPaths()
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
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