4 void SetupDefaultAddressBook(){
6 // Check if the 'Default.local' directory exists.
8 wxString DefaultLocalDir;
10 #if defined(__HAIKU__)
12 //preffilename = wxT("noo");
14 #elif defined(__WIN32__)
16 DefaultLocalDir.Clear();
17 DefaultLocalDir.Append(wxString::FromUTF8(getenv("APPDATA")));
18 DefaultLocalDir.Append(wxT("\\Xestia\\Address Book\\accounts\\"));
19 DefaultLocalDir.Append(wxT("Default.local"));
21 #elif defined(__APPLE__)
23 DefaultLocalDir.Clear();
24 DefaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
25 DefaultLocalDir.Append(wxT("/Library/Preferences/Xestia/Address Book/accounts/"));
26 DefaultLocalDir.Append(wxT("Default.local"));
30 DefaultLocalDir.Clear();
31 DefaultLocalDir.Append(wxString::FromUTF8(getenv("HOME")));
32 DefaultLocalDir.Append(wxT("/.xestiaab/accounts/"));
33 DefaultLocalDir.Append(wxT("Default.local"));
37 if (wxDirExists(DefaultLocalDir) == FALSE){
39 if (wxMkdir(DefaultLocalDir, 0740) == TRUE){
47 void SetupDefaultSettings(){
49 // Setup default (non account) settings if they don't exist.
51 wxString DefaultPrefDir;
53 #if defined(__HAIKU__)
55 //preffilename = wxT("noo");
57 #elif defined(__WIN32__)
59 DefaultPrefDir.Clear();
60 DefaultPrefDir.Append(wxString::FromUTF8(getenv("APPDATA")));
61 DefaultPrefDir.Append(wxT("\\Xestia\\Address Book\\preferences\\"));
63 #elif defined(__APPLE__)
65 DefaultPrefDir.Clear();
66 DefaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
67 DefaultPrefDir.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences"));
71 DefaultPrefDir.Clear();
72 DefaultPrefDir.Append(wxString::FromUTF8(getenv("HOME")));
73 DefaultPrefDir.Append(wxT("/.xestiaab/preferences/"));
77 // Create the accounts file if it doesn't exist.
79 if (wxFileExists(DefaultPrefDir + wxT("accounts")) == FALSE){
81 wxString AccountsFilename;
84 AccountsFilename = DefaultPrefDir;
85 AccountsFilename.Append(wxT("accounts"));
87 #if wxABI_VERSION < 20900
88 AccountsFile.Open(AccountsFilename.c_str(), wxT("w"));
90 AccountsFile.Open(AccountsFilename, wxT("w"));
93 AccountsFile.Write(wxT(""));
97 // Create the preferences file if it doesn't exist.
99 if (wxFileExists(DefaultPrefDir + wxT("settings")) == FALSE){
101 wxString PrefsFilename;
104 PrefsFilename = DefaultPrefDir;
105 PrefsFilename.Append(wxT("settings"));
107 #if wxABI_VERSION < 20900
108 PrefsFile.Open(PrefsFilename.c_str(), wxT("w"));
110 PrefsFile.Open(PrefsFilename, wxT("w"));
113 PrefsFile.Write(wxT("HideLocalAddressBooks=false\nSaveWindowPosition=true\n"));
119 void SetupDirectories(){
121 // Create the directories if they don't exist.
123 wxString DefaultSettingsDir;
125 #if defined(__HAIKU__)
127 //preffilename = wxT("noo");
129 #elif defined(__WIN32__)
131 DefaultSettingsDir.Clear();
132 DefaultSettingsDir.Append(wxString::FromUTF8(getenv("APPDATA")));
133 DefaultSettingsDir.Append(wxT("\\Xestia\\"));
135 if (wxDirExists(DefaultSettingsDir) == FALSE){
137 // Create the directory.
139 if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
145 // TODO: APPEND 'Address Book' to the directory.
147 DefaultSettingsDir.Append(wxT("\\Address Book\\"));
149 #elif defined(__APPLE__)
151 DefaultSettingsDir.Clear();
152 DefaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
153 DefaultSettingsDir.Append(wxT("/Library/Preferences/Xestia/"));
155 if (wxDirExists(DefaultSettingsDir) == FALSE){
157 // Create the directory.
159 if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
165 // TODO: APPEND 'Address Book' to the directory.
167 DefaultSettingsDir.Append(wxT("/Address Book/"));
171 DefaultSettingsDir.Clear();
172 DefaultSettingsDir.Append(wxString::FromUTF8(getenv("HOME")));
173 DefaultSettingsDir.Append(wxT("/.xestiaab/"));
177 // Check if the directory exists.
179 if (wxDirExists(DefaultSettingsDir) == FALSE){
181 // Create the directory.
183 if (wxMkdir(DefaultSettingsDir, 0740) == TRUE){
189 if (wxDirExists(DefaultSettingsDir + wxT("accounts")) == FALSE){
191 if (wxMkdir(DefaultSettingsDir + wxT("accounts"), 0740) == TRUE){
197 if (wxDirExists(DefaultSettingsDir + wxT("preferences")) == FALSE){
199 if (wxMkdir(DefaultSettingsDir + wxT("preferences"), 0740) == TRUE){