1 // dirs.cpp - Directory subroutines.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book 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 Address Book 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 Address Book. If not, see <http://www.gnu.org/licenses/>
26 #if defined(__HAIKU__)
28 //preffilename = wxT("noo");
30 #elif defined(__WIN32__)
33 UserDir.Append(wxString::FromUTF8(getenv("APPDATA")));
34 UserDir.Append(wxT("\\Xestia\\Address Book\\"));
36 #elif defined(__APPLE__)
39 UserDir.Append(wxString::FromUTF8(getenv("HOME")));
40 UserDir.Append(wxT("/Library/Preferences/Xestia/Address Book/"));
45 UserDir.Append(wxString::FromUTF8(getenv("HOME")));
46 UserDir.Append(wxT("/.xestiaab/"));
54 wxString GetUserPrefDir()
59 #if defined(__HAIKU__)
61 //preffilename = wxT("noo");
63 #elif defined(__WIN32__)
66 UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
67 UserPrefDir.Append(wxT("\\Xestia\\Address Book\\preferences\\"));
69 #elif defined(__APPLE__)
72 UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
73 UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/"));
78 UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
79 UserPrefDir.Append(wxT("/.xestiaab/preferences/"));
87 wxString GetRecoveryDB()
90 wxString RecoveryDBFile;
92 #if defined(__HAIKU__)
94 //preffilename = wxT("noo");
96 #elif defined(__WIN32__)
98 RecoveryDBFile.Clear();
99 RecoveryDBFile.Append(wxString::FromUTF8(getenv("APPDATA")));
100 RecoveryDBFile.Append(wxT("\\Xestia\\Address Book\\recovery.db"));
102 #elif defined(__APPLE__)
104 RecoveryDBFile.Clear();
105 RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME")));
106 RecoveryDBFile.Append(wxT("/Library/Preferences/Xestia/Address Book/recovery.db"));
110 RecoveryDBFile.Clear();
111 RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME")));
112 RecoveryDBFile.Append(wxT("/.xestiaab/.recovery.db"));
116 return RecoveryDBFile;
120 wxString GetAccountDir(wxString AccName, bool ServerCert)
125 #if defined(__HAIKU__)
127 #elif defined(__WIN32__)
130 AccountDir.Append(wxString::FromUTF8(getenv("APPDATA")));
131 AccountDir.Append(wxT("\\Xestia\\Address Book\\accounts\\"));
132 AccountDir.Append(AccName);
133 AccountDir.Append(wxT("\\"));
134 if (ServerCert == TRUE){
135 AccountDir.Append(wxT("server.crt"));
138 #elif defined(__APPLE__)
141 AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
142 AccountDir.Append(wxT("/Library/Preferences/Xestia/Address Book/accounts/"));
143 AccountDir.Append(AccName);
144 AccountDir.Append(wxT("/"));
145 if (ServerCert == TRUE){
146 AccountDir.Append(wxT("server.crt"));
152 AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
153 AccountDir.Append(wxT("/.xestiaab/accounts/"));
154 AccountDir.Append(AccName);
155 AccountDir.Append(wxT("/"));
156 if (ServerCert == TRUE){
157 AccountDir.Append(wxT("server.crt"));
166 wxString GetAccountsFile()
169 wxString AccountsFile;
171 #if defined(__HAIKU__)
173 #elif defined(__WIN32__)
175 AccountsFile.Clear();
176 AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
177 AccountsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\accounts"));
179 #elif defined(__WIN32__)
181 AccountsFile.Clear();
182 AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
183 AccountsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/accounts"));
187 AccountsFile.Clear();
188 AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
189 AccountsFile.Append(wxT("/.xestiaab/preferences/accounts"));
197 wxString GetSettingsFile()
200 wxString SettingsFile;
202 #if defined(__HAIKU__)
204 #elif defined(__WIN32__)
206 SettingsFile.Clear();
207 SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
208 SettingsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\settings"));
210 #elif defined(__APPLE__)
212 SettingsFile.Clear();
213 SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
214 SettingsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/settings"));
218 SettingsFile.Clear();
219 SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
220 SettingsFile.Append(wxT("/.xestiaab/preferences/settings"));