]>
git.saurik.com Git - wxWidgets.git/blob - src/unix/stdpaths.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: unix/stdpaths.cpp
3 // Purpose: wxStandardPaths implementation for Unix & OpenVMS systems
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
33 #include "wx/filename.h"
35 #include "wx/stdpaths.h"
37 #if defined( __LINUX__ ) || defined( __VMS )
41 // ============================================================================
42 // wxStandardPaths implementation
43 // ============================================================================
45 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
49 void wxStandardPaths::SetInstallPrefix(const wxString
& prefix
)
54 wxString
wxStandardPaths::GetInstallPrefix() const
58 wxStandardPaths
*pathPtr
= wx_const_cast(wxStandardPaths
*, this);
61 // under Linux, we can get location of the executable
65 // FIXME: is readlink() Unicode-aware or not???
66 result
= readlink( (const char*)wxT("/proc/self/exe"), (char*)buf
, WXSIZEOF(buf
) - sizeof(wxChar
) );
69 buf
[result
] = wxChar(0);
70 wxString
exeStr( buf
, wxConvLibc
);
72 // consider that we're in the last "bin" subdirectory of our prefix
73 wxString
basename( wxString(wxTheApp
->argv
[0]).AfterLast( wxChar('/')) );
74 size_t pos
= exeStr
.find( wxT("/bin/") + basename
);
75 if (pos
!= wxString::npos
)
76 pathPtr
->m_prefix
.assign( exeStr
, 0, pos
);
83 pathPtr
->m_prefix
= wxT("/sys$system");
85 pathPtr
->m_prefix
= wxT("/usr/local");
93 // ----------------------------------------------------------------------------
95 // ----------------------------------------------------------------------------
97 wxString
wxStandardPaths::GetConfigDir() const
100 return _T("/sys$manager");
106 wxString
wxStandardPaths::GetUserConfigDir() const
108 return wxFileName::GetHomeDir();
111 wxString
wxStandardPaths::GetDataDir() const
114 return AppendAppName(GetInstallPrefix() + _T("/sys$share"));
116 return AppendAppName(GetInstallPrefix() + _T("/share"));
120 wxString
wxStandardPaths::GetLocalDataDir() const
123 return AppendAppName(_T("/sys$manager"));
125 return AppendAppName(_T("/etc"));
129 wxString
wxStandardPaths::GetUserDataDir() const
132 return wxFileName::GetHomeDir();
134 return AppendAppName(wxFileName::GetHomeDir() + _T("/."));
138 wxString
wxStandardPaths::GetPluginsDir() const
143 #endif // wxUSE_STDPATHS