1 // dirs.cpp - Directory subroutines.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Calendar. Originally from Xestia Address Book.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
24 // Get the user directory.
28 #if defined(__HAIKU__)
30 #elif defined(__WIN32__)
33 UserDir.Append(wxString::FromUTF8(getenv("APPDATA")));
34 UserDir.Append(wxT("\\Xestia\\Calendar\\"));
36 #elif defined(__APPLE__)
39 UserDir.Append(wxString::FromUTF8(getenv("HOME")));
40 UserDir.Append(wxT("/Library/Preferences/Xestia/Calendar/"));
45 UserDir.Append(wxString::FromUTF8(getenv("HOME")));
46 UserDir.Append(wxT("/.xestiacal/"));
54 wxString GetUserPrefDir()
57 // Get the user preferences directory.
61 #if defined(__HAIKU__)
63 #elif defined(__WIN32__)
66 UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
67 UserPrefDir.Append(wxT("\\Xestia\\Calendar\\preferences\\"));
69 #elif defined(__APPLE__)
72 UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
73 UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/"));
78 UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
79 UserPrefDir.Append(wxT("/.xestiacal/preferences/"));
87 wxString GetAccountDir(wxString AccName, bool ServerCert)
90 // Get the account directory.
94 #if defined(__HAIKU__)
96 #elif defined(__WIN32__)
99 AccountDir.Append(wxString::FromUTF8(getenv("APPDATA")));
100 AccountDir.Append(wxT("\\Xestia\\Calendar\\accounts\\"));
101 AccountDir.Append(AccName);
102 AccountDir.Append(wxT("\\"));
104 if (ServerCert == TRUE){
105 AccountDir.Append(wxT("server.crt"));
108 #elif defined(__APPLE__)
111 AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
112 AccountDir.Append(wxT("/Library/Preferences/Xestia/Calendar/accounts/"));
113 AccountDir.Append(AccName);
114 AccountDir.Append(wxT("/"));
116 if (ServerCert == TRUE){
117 AccountDir.Append(wxT("server.crt"));
123 AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
124 AccountDir.Append(wxT("/.xestiacal/accounts/"));
125 AccountDir.Append(AccName);
126 AccountDir.Append(wxT("/"));
128 if (ServerCert == TRUE){
129 AccountDir.Append(wxT("server.crt"));
138 std::string GetAccountDir(std::string AccName, bool ServerCert)
141 // Get the account directory.
143 std::string AccountDir;
145 #if defined(__HAIKU__)
147 #elif defined(__WIN32__)
150 AccountDir.append(getenv("APPDATA"));
151 AccountDir.append("\\Xestia\\Calendar\\accounts\\");
152 AccountDir.append(AccName);
153 AccountDir.append("\\");
155 if (ServerCert == true){
156 AccountDir.append("server.crt");
159 #elif defined(__APPLE__)
162 AccountDir.append(getenv("HOME"));
163 AccountDir.append("/Library/Preferences/Xestia/Calendar/accounts/");
164 AccountDir.append(AccName);
165 AccountDir.append("/");
167 if (ServerCert == true){
168 AccountDir.append("server.crt");
174 AccountDir.append(getenv("HOME"));
175 AccountDir.append("/.xestiacal/accounts/");
176 AccountDir.append(AccName);
177 AccountDir.append("/");
179 if (ServerCert == true){
180 AccountDir.append("server.crt");
189 wxString GetAccountsFile()
192 // Get the accounts preferences file.
194 wxString AccountsFile;
196 #if defined(__HAIKU__)
198 #elif defined(__WIN32__)
200 AccountsFile.Clear();
201 AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
202 AccountsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\accounts"));
204 #elif defined(__APPLE__)
206 AccountsFile.Clear();
207 AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
208 AccountsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/accounts"));
212 AccountsFile.Clear();
213 AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
214 AccountsFile.Append(wxT("/.xestiacal/preferences/accounts"));
222 wxString GetSettingsFile()
225 // Get the preferences general settings file.
227 wxString SettingsFile;
229 #if defined(__HAIKU__)
231 #elif defined(__WIN32__)
233 SettingsFile.Clear();
234 SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
235 SettingsFile.Append(wxT("\\Xestia\\Calendar\\preferences\\settings"));
237 #elif defined(__APPLE__)
239 SettingsFile.Clear();
240 SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
241 SettingsFile.Append(wxT("/Library/Preferences/Xestia/Calendar/preferences/settings"));
245 SettingsFile.Clear();
246 SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
247 SettingsFile.Append(wxT("/.xestiacal/preferences/settings"));