From d160e5ab021b22f481095f047ce6b0330e83b954 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 19 Oct 2017 15:37:35 +0200 Subject: [PATCH] add data and config path getter for windows --- src/core/paths/paths-windows.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/core/paths/paths-windows.cpp b/src/core/paths/paths-windows.cpp index 94b8705ca..8af9d8a4a 100644 --- a/src/core/paths/paths-windows.cpp +++ b/src/core/paths/paths-windows.cpp @@ -17,6 +17,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include +#include "shlobj.h" + #include "core/platform-helpers/platform-helpers.h" #include "linphone/utils/utils.h" @@ -24,16 +27,27 @@ // ============================================================================= +using namespace std; + LINPHONE_BEGIN_NAMESPACE -std::string SysPaths::getDataPath (PlatformHelpers *platformHelper) { - //TODO. +string SysPaths::getDataPath (PlatformHelpers *platformHelper) { + TCHAR szPath[MAX_PATH]; + // Get path for each computer, non-user specific and non-roaming data. + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath))) { + stringstream path; + path << boost::lexical_cast(szPath) << "/linphone"; + string ret = path.str(); + boost::replace_all(ret, "\\", "\\\\"); + return ret; + } + return Utils::getEmptyConstRefObject(); } -std::string SysPaths::getConfigPath (PlatformHelpers *platformHelper) { - //TODO. - return Utils::getEmptyConstRefObject(); +string SysPaths::getConfigPath (PlatformHelpers *platformHelper) { + // seems to be the same directory + return getDataPath(platformHelper); } LINPHONE_END_NAMESPACE