From c7879876fbfc4405946aea156f115ce096615858 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 10 Mar 2016 08:39:20 +0000 Subject: [PATCH] Added comments to the functions of common/dirs.cpp --- source/common/dirs.cpp | 189 +++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 90 deletions(-) diff --git a/source/common/dirs.cpp b/source/common/dirs.cpp index 0abe0a6..8a34b19 100644 --- a/source/common/dirs.cpp +++ b/source/common/dirs.cpp @@ -21,206 +21,215 @@ wxString GetUserDir() { - wxString UserDir; + // Get the user directory. -#if defined(__HAIKU__) - - //preffilename = wxT("noo"); + wxString UserDir; +#if defined(__HAIKU__) + #elif defined(__WIN32__) - UserDir.Clear(); - UserDir.Append(wxString::FromUTF8(getenv("APPDATA"))); - UserDir.Append(wxT("\\Xestia\\Address Book\\")); + UserDir.Clear(); + UserDir.Append(wxString::FromUTF8(getenv("APPDATA"))); + UserDir.Append(wxT("\\Xestia\\Address Book\\")); #elif defined(__APPLE__) - UserDir.Clear(); - UserDir.Append(wxString::FromUTF8(getenv("HOME"))); - UserDir.Append(wxT("/Library/Preferences/Xestia/Address Book/")); + UserDir.Clear(); + UserDir.Append(wxString::FromUTF8(getenv("HOME"))); + UserDir.Append(wxT("/Library/Preferences/Xestia/Address Book/")); #else - UserDir.Clear(); - UserDir.Append(wxString::FromUTF8(getenv("HOME"))); - UserDir.Append(wxT("/.xestiaab/")); + UserDir.Clear(); + UserDir.Append(wxString::FromUTF8(getenv("HOME"))); + UserDir.Append(wxT("/.xestiaab/")); #endif - return UserDir; + return UserDir; } wxString GetUserPrefDir() { - wxString UserPrefDir; - -#if defined(__HAIKU__) + // Get the user preferences directory. - //preffilename = wxT("noo"); + wxString UserPrefDir; +#if defined(__HAIKU__) + #elif defined(__WIN32__) - UserPrefDir.Clear(); - UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA"))); - UserPrefDir.Append(wxT("\\Xestia\\Address Book\\preferences\\")); + UserPrefDir.Clear(); + UserPrefDir.Append(wxString::FromUTF8(getenv("APPDATA"))); + UserPrefDir.Append(wxT("\\Xestia\\Address Book\\preferences\\")); #elif defined(__APPLE__) - UserPrefDir.Clear(); - UserPrefDir.Append(wxString::FromUTF8(getenv("HOME"))); - UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/")); + UserPrefDir.Clear(); + UserPrefDir.Append(wxString::FromUTF8(getenv("HOME"))); + UserPrefDir.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/")); #else - UserPrefDir.Clear(); - UserPrefDir.Append(wxString::FromUTF8(getenv("HOME"))); - UserPrefDir.Append(wxT("/.xestiaab/preferences/")); + UserPrefDir.Clear(); + UserPrefDir.Append(wxString::FromUTF8(getenv("HOME"))); + UserPrefDir.Append(wxT("/.xestiaab/preferences/")); #endif - return UserPrefDir; + return UserPrefDir; } wxString GetRecoveryDB() { - wxString RecoveryDBFile; - -#if defined(__HAIKU__) + // Get recovery database. - //preffilename = wxT("noo"); + wxString RecoveryDBFile; +#if defined(__HAIKU__) + #elif defined(__WIN32__) - RecoveryDBFile.Clear(); - RecoveryDBFile.Append(wxString::FromUTF8(getenv("APPDATA"))); - RecoveryDBFile.Append(wxT("\\Xestia\\Address Book\\recovery.db")); + RecoveryDBFile.Clear(); + RecoveryDBFile.Append(wxString::FromUTF8(getenv("APPDATA"))); + RecoveryDBFile.Append(wxT("\\Xestia\\Address Book\\recovery.db")); #elif defined(__APPLE__) - RecoveryDBFile.Clear(); - RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME"))); - RecoveryDBFile.Append(wxT("/Library/Preferences/Xestia/Address Book/recovery.db")); + RecoveryDBFile.Clear(); + RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME"))); + RecoveryDBFile.Append(wxT("/Library/Preferences/Xestia/Address Book/recovery.db")); #else - RecoveryDBFile.Clear(); - RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME"))); - RecoveryDBFile.Append(wxT("/.xestiaab/.recovery.db")); + RecoveryDBFile.Clear(); + RecoveryDBFile.Append(wxString::FromUTF8(getenv("HOME"))); + RecoveryDBFile.Append(wxT("/.xestiaab/.recovery.db")); #endif - return RecoveryDBFile; + return RecoveryDBFile; } wxString GetAccountDir(wxString AccName, bool ServerCert) { - wxString AccountDir; + // Get the account directory. + + wxString AccountDir; #if defined(__HAIKU__) #elif defined(__WIN32__) - AccountDir.Clear(); - AccountDir.Append(wxString::FromUTF8(getenv("APPDATA"))); - AccountDir.Append(wxT("\\Xestia\\Address Book\\accounts\\")); - AccountDir.Append(AccName); - AccountDir.Append(wxT("\\")); - if (ServerCert == TRUE){ - AccountDir.Append(wxT("server.crt")); - } + AccountDir.Clear(); + AccountDir.Append(wxString::FromUTF8(getenv("APPDATA"))); + AccountDir.Append(wxT("\\Xestia\\Address Book\\accounts\\")); + AccountDir.Append(AccName); + AccountDir.Append(wxT("\\")); + + if (ServerCert == TRUE){ + AccountDir.Append(wxT("server.crt")); + } #elif defined(__APPLE__) - AccountDir.Clear(); - AccountDir.Append(wxString::FromUTF8(getenv("HOME"))); - AccountDir.Append(wxT("/Library/Preferences/Xestia/Address Book/accounts/")); - AccountDir.Append(AccName); - AccountDir.Append(wxT("/")); - if (ServerCert == TRUE){ - AccountDir.Append(wxT("server.crt")); - } + AccountDir.Clear(); + AccountDir.Append(wxString::FromUTF8(getenv("HOME"))); + AccountDir.Append(wxT("/Library/Preferences/Xestia/Address Book/accounts/")); + AccountDir.Append(AccName); + AccountDir.Append(wxT("/")); + + if (ServerCert == TRUE){ + AccountDir.Append(wxT("server.crt")); + } #else - AccountDir.Clear(); - AccountDir.Append(wxString::FromUTF8(getenv("HOME"))); - AccountDir.Append(wxT("/.xestiaab/accounts/")); - AccountDir.Append(AccName); - AccountDir.Append(wxT("/")); - if (ServerCert == TRUE){ - AccountDir.Append(wxT("server.crt")); - } + AccountDir.Clear(); + AccountDir.Append(wxString::FromUTF8(getenv("HOME"))); + AccountDir.Append(wxT("/.xestiaab/accounts/")); + AccountDir.Append(AccName); + AccountDir.Append(wxT("/")); + + if (ServerCert == TRUE){ + AccountDir.Append(wxT("server.crt")); + } #endif - return AccountDir; + return AccountDir; } wxString GetAccountsFile() { - wxString AccountsFile; + // Get the accounts preferences file. + + wxString AccountsFile; #if defined(__HAIKU__) #elif defined(__WIN32__) - AccountsFile.Clear(); - AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA"))); - AccountsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\accounts")); + AccountsFile.Clear(); + AccountsFile.Append(wxString::FromUTF8(getenv("APPDATA"))); + AccountsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\accounts")); #elif defined(__WIN32__) - AccountsFile.Clear(); - AccountsFile.Append(wxString::FromUTF8(getenv("HOME"))); - AccountsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/accounts")); + AccountsFile.Clear(); + AccountsFile.Append(wxString::FromUTF8(getenv("HOME"))); + AccountsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/accounts")); #else - AccountsFile.Clear(); - AccountsFile.Append(wxString::FromUTF8(getenv("HOME"))); - AccountsFile.Append(wxT("/.xestiaab/preferences/accounts")); + AccountsFile.Clear(); + AccountsFile.Append(wxString::FromUTF8(getenv("HOME"))); + AccountsFile.Append(wxT("/.xestiaab/preferences/accounts")); #endif - return AccountsFile; + return AccountsFile; } wxString GetSettingsFile() { - wxString SettingsFile; + // Get the preferences general settings file. + + wxString SettingsFile; #if defined(__HAIKU__) #elif defined(__WIN32__) - SettingsFile.Clear(); - SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA"))); - SettingsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\settings")); + SettingsFile.Clear(); + SettingsFile.Append(wxString::FromUTF8(getenv("APPDATA"))); + SettingsFile.Append(wxT("\\Xestia\\Address Book\\preferences\\settings")); #elif defined(__APPLE__) - SettingsFile.Clear(); - SettingsFile.Append(wxString::FromUTF8(getenv("HOME"))); - SettingsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/settings")); + SettingsFile.Clear(); + SettingsFile.Append(wxString::FromUTF8(getenv("HOME"))); + SettingsFile.Append(wxT("/Library/Preferences/Xestia/Address Book/preferences/settings")); #else - SettingsFile.Clear(); - SettingsFile.Append(wxString::FromUTF8(getenv("HOME"))); - SettingsFile.Append(wxT("/.xestiaab/preferences/settings")); + SettingsFile.Clear(); + SettingsFile.Append(wxString::FromUTF8(getenv("HOME"))); + SettingsFile.Append(wxT("/.xestiaab/preferences/settings")); #endif - return SettingsFile; + return SettingsFile; } \ No newline at end of file -- 2.39.5