From 3d39423f5efef65eacf666dabd7d1c6e9ba13083 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 21 Aug 2016 22:56:38 +0100 Subject: [PATCH] Add std::string version of the GetAccountDir function --- source/common/dirs.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++ source/common/dirs.h | 1 + 2 files changed, 52 insertions(+) diff --git a/source/common/dirs.cpp b/source/common/dirs.cpp index e0e6510..3baf541 100644 --- a/source/common/dirs.cpp +++ b/source/common/dirs.cpp @@ -168,6 +168,57 @@ wxString GetAccountDir(wxString AccName, bool ServerCert) } +std::string GetAccountDir(std::string AccName, bool ServerCert) +{ + + // Get the account directory. + + std::string AccountDir; + +#if defined(__HAIKU__) + +#elif defined(__WIN32__) + + AccountDir.clear(); + AccountDir.append(getenv("APPDATA")); + AccountDir.append("\\Xestia\\Address Book\\accounts\\"); + AccountDir.append(AccName); + AccountDir.append("\\"); + + if (ServerCert == true){ + AccountDir.append(wxT("server.crt")); + } + +#elif defined(__APPLE__) + + AccountDir.clear(); + AccountDir.append(getenv("HOME")); + AccountDir.append("/Library/Preferences/Xestia/Address Book/accounts/"); + AccountDir.append(AccName); + AccountDir.append("/"); + + if (ServerCert == true){ + AccountDir.append("server.crt"); + } + +#else + + AccountDir.clear(); + AccountDir.append(getenv("HOME")); + AccountDir.append("/.xestiaab/accounts/"); + AccountDir.append(AccName); + AccountDir.append("/"); + + if (ServerCert == true){ + AccountDir.append("server.crt"); + } + +#endif + + return AccountDir; + +} + wxString GetAccountsFile() { diff --git a/source/common/dirs.h b/source/common/dirs.h index 120121d..4731f68 100644 --- a/source/common/dirs.h +++ b/source/common/dirs.h @@ -25,6 +25,7 @@ wxString GetUserDir(); wxString GetUserPrefDir(); wxString GetRecoveryDB(); wxString GetAccountDir(wxString AccName, bool ServerCert); +std::string GetAccountDir(std::string AccName, bool ServerCert); wxString GetAccountsFile(); wxString GetSettingsFile(); -- 2.39.5