From dcd000afc4b6ee2b98e10c979a6b1b96d332dcba Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Fri, 3 Jul 2020 07:46:32 +0200 Subject: [PATCH] use Downloads folder --- CMainWindow.h | 1 - GateKeeper.cpp | 13 +++++++++---- stdafx.h | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMainWindow.h b/CMainWindow.h index b05ea31..6875c9b 100644 --- a/CMainWindow.h +++ b/CMainWindow.h @@ -27,7 +27,6 @@ public: LRESULT OnNotification(UINT /*nMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT OnMenuCommand(UINT /*nMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); -protected: typedef std::basic_string tstring; void ShowNotificationInfo(tstring title, tstring text); }; diff --git a/GateKeeper.cpp b/GateKeeper.cpp index c66f617..7e32a9e 100644 --- a/GateKeeper.cpp +++ b/GateKeeper.cpp @@ -567,17 +567,22 @@ namespace pEp { BCryptDestroyKey(dk); - TCHAR temp_path[MAX_PATH + 1]; - GetTempPath(MAX_PATH, temp_path); + TCHAR download_path[MAX_PATH + 1]; + PWSTR _downloads; + SHGetKnownFolderPath(FOLDERID_Downloads, 0, NULL, &_downloads); + StringCchCopy(download_path, MAX_PATH, _downloads); + CoTaskMemFree(_downloads); + + GetTempPath(MAX_PATH, download_path); if (filename == _T("")) { - filename = temp_path; + filename = download_path; filename += _T("\\pEp_"); filename += delivery.substr(0, 32); filename += _T(".msi"); } else { - filename = tstring(temp_path) + _T("\\") + filename; + filename = tstring(download_path) + _T("\\") + filename; } hFile = CreateFile(filename.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/stdafx.h b/stdafx.h index 67d66f9..c152662 100644 --- a/stdafx.h +++ b/stdafx.h @@ -29,6 +29,7 @@ #include #include +#include #include #include