Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Ignore build* directories
[xestiaab/.git] / source / common / dirs.cpp
1 // dirs.cpp - Directory subroutines.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
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.
10 //
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.
15 //
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/>
19 #include <wx/wx.h>
21 wxString GetUserDir()
22 {
23     
24         // Get the user directory.
25     
26         wxString UserDir;
27     
28 #if defined(__HAIKU__)
29         
30 #elif defined(__WIN32__)
31     
32         UserDir.Clear();
33         UserDir.Append(wxString::FromUTF8(getenv("APPDATA")));
34         UserDir.Append(wxT("\\Xestia\\Address Book\\"));
35     
36 #elif defined(__APPLE__)
37     
38         UserDir.Clear();
39         UserDir.Append(wxString::FromUTF8(getenv("HOME")));
40         UserDir.Append(wxT("/Library/Preferences/Xestia/Address Book/"));
41     
42 #else
43     
44         UserDir.Clear();
45         UserDir.Append(wxString::FromUTF8(getenv("HOME")));
46         UserDir.Append(wxT("/.xestiaab/"));
47     
48 #endif
49     
50         return UserDir;
51     
52 }
54 wxString GetUserPrefDir()
55 {
56     
57         // Get the user preferences directory.
58     
59         wxString UserPrefDir;
60     
61 #if defined(__HAIKU__)
62         
63 #elif defined(__WIN32__)
64     
65         UserPrefDir.Clear();
66         UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
67         UserPrefDir.Append(wxT("\\Xestia\\Address Book\\preferences\\"));
68     
69 #elif defined(__APPLE__)
70     
71         UserPrefDir.Clear();
72         UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
73         UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/"));
74     
75 #else
76     
77         UserPrefDir.Clear();
78         UserPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
79         UserPrefDir.Append(wxT("/.xestiaab/preferences/"));
80     
81 #endif
82     
83         return UserPrefDir;
84     
85 }
87 wxString GetRecoveryDB()
88 {
89     
90         // Get recovery database.
91     
92         wxString RecoveryDBFile;
93     
94 #if defined(__HAIKU__)
95         
96 #elif defined(__WIN32__)
97     
98         RecoveryDBFile.Clear();
99         RecoveryDBFile.Append(wxString::FromUTF8(getenv("APPDATA")));
100         RecoveryDBFile.Append(wxT("\\Xestia\\Address Book\\recovery.db"));
101     
102 #elif defined(__APPLE__)
103     
104         RecoveryDBFile.Clear();
105         RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME")));
106         RecoveryDBFile.Append(wxT("/Library/Preferences/Xestia/Address Book/recovery.db"));
107     
108 #else
109     
110         RecoveryDBFile.Clear();
111         RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME")));
112         RecoveryDBFile.Append(wxT("/.xestiaab/.recovery.db"));
113     
114 #endif
115     
116         return RecoveryDBFile;
117     
120 wxString GetAccountDir(wxString AccName, bool ServerCert)
122     
123         // Get the account directory.
124     
125         wxString AccountDir;
126     
127 #if defined(__HAIKU__)
128     
129 #elif defined(__WIN32__)
130     
131         AccountDir.Clear();
132         AccountDir.Append(wxString::FromUTF8(getenv("APPDATA")));
133         AccountDir.Append(wxT("\\Xestia\\Address Book\\accounts\\"));
134         AccountDir.Append(AccName);
135         AccountDir.Append(wxT("\\"));
136     
137         if (ServerCert == TRUE){
138                 AccountDir.Append(wxT("server.crt"));
139         }
140     
141 #elif defined(__APPLE__)
142     
143         AccountDir.Clear();
144         AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
145         AccountDir.Append(wxT("/Library/Preferences/Xestia/Address Book/accounts/"));
146         AccountDir.Append(AccName);
147         AccountDir.Append(wxT("/"));
148     
149         if (ServerCert == TRUE){
150                 AccountDir.Append(wxT("server.crt"));
151         }
152     
153 #else
154     
155         AccountDir.Clear();
156         AccountDir.Append(wxString::FromUTF8(getenv("HOME")));
157         AccountDir.Append(wxT("/.xestiaab/accounts/"));
158         AccountDir.Append(AccName);
159         AccountDir.Append(wxT("/"));
160     
161         if (ServerCert == TRUE){
162                 AccountDir.Append(wxT("server.crt"));
163         }
164     
165 #endif
166     
167         return AccountDir;
168     
171 std::string GetAccountDir(std::string AccName, bool ServerCert)
173     
174         // Get the account directory.
175     
176         std::string AccountDir;
177     
178 #if defined(__HAIKU__)
179     
180 #elif defined(__WIN32__)
181     
182         AccountDir.clear();
183         AccountDir.append(getenv("APPDATA"));
184         AccountDir.append("\\Xestia\\Address Book\\accounts\\");
185         AccountDir.append(AccName);
186         AccountDir.append("\\");
187     
188         if (ServerCert == true){
189                 AccountDir.append("server.crt");
190         }
191     
192 #elif defined(__APPLE__)
193     
194         AccountDir.clear();
195         AccountDir.append(getenv("HOME"));
196         AccountDir.append("/Library/Preferences/Xestia/Address Book/accounts/");
197         AccountDir.append(AccName);
198         AccountDir.append("/");
199     
200         if (ServerCert == true){
201                 AccountDir.append("server.crt");
202         }
203     
204 #else
205     
206         AccountDir.clear();
207         AccountDir.append(getenv("HOME"));
208         AccountDir.append("/.xestiaab/accounts/");
209         AccountDir.append(AccName);
210         AccountDir.append("/");
211     
212         if (ServerCert == true){
213                 AccountDir.append("server.crt");
214         }
216 #endif
217     
218         return AccountDir;
219     
222 wxString GetAccountsFile()
224     
225         // Get the accounts preferences file.
226     
227         wxString AccountsFile;
228     
229 #if defined(__HAIKU__)
230     
231 #elif defined(__WIN32__)
232     
233         AccountsFile.Clear();
234         AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
235         AccountsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\accounts"));
236     
237 #elif defined(__APPLE__)
238     
239         AccountsFile.Clear();
240         AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
241         AccountsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/accounts"));
242     
243 #else
244     
245         AccountsFile.Clear();
246         AccountsFile.Append(wxString::FromUTF8(getenv("HOME")));
247         AccountsFile.Append(wxT("/.xestiaab/preferences/accounts"));
248     
249 #endif
250     
251         return AccountsFile;
252     
255 wxString GetSettingsFile()
257     
258         // Get the preferences general settings file.
259     
260         wxString SettingsFile;
261     
262 #if defined(__HAIKU__)
263     
264 #elif defined(__WIN32__)
265     
266         SettingsFile.Clear();
267         SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA")));
268         SettingsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\settings"));
269     
270 #elif defined(__APPLE__)
271     
272         SettingsFile.Clear();
273         SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
274         SettingsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/settings"));
275     
276 #else
277     
278         SettingsFile.Clear();
279         SettingsFile.Append(wxString::FromUTF8(getenv("HOME")));
280         SettingsFile.Append(wxT("/.xestiaab/preferences/settings"));
281     
282 #endif
283     
284         return SettingsFile;
285     
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy