1 // dirs.cpp - Directory subroutines.
3 // (c) 2012-2017 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"));