diff options
-rw-r--r-- | extensions/source/update/check/updatecheckconfig.cxx | 10 | ||||
-rw-r--r-- | extensions/source/update/check/updatecheckconfig.hxx | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 1eaab8162485..5befb380f243 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -34,6 +34,7 @@ #pragma warning(push,1) // disable warnings within system headers #pragma warning(disable: 4917) #endif +#include <objbase.h> #include <shlobj.h> #ifdef _MSC_VER #pragma warning(pop) @@ -159,16 +160,17 @@ UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const } } -OUString UpdateCheckConfig::getDesktopDirectory() +OUString UpdateCheckConfig::getDownloadsDirectory() { OUString aRet; #ifdef _WIN32 - WCHAR szPath[MAX_PATH]; + PWSTR szPath; - if (TRUE == SHGetSpecialFolderPathW(nullptr, szPath, CSIDL_DESKTOPDIRECTORY, true)) + if (SHGetKnownFolderPath(FOLDERID_Downloads, 0, nullptr, &szPath) == S_OK) { aRet = OUString( reinterpret_cast< sal_Unicode * >(szPath) ); + CoTaskMemFree(szPath); osl::FileBase::getFileURLFromSystemPath( aRet, aRet ); } #else @@ -471,7 +473,7 @@ UpdateCheckConfig::getByName( const OUString& aName ) aValue >>= aStr; if( aStr.isEmpty() ) - aValue <<= getDesktopDirectory(); + aValue <<= getDownloadsDirectory(); } return aValue; } diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index f130811c1581..c76c876ec568 100644 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -137,8 +137,8 @@ public: // Stores the bool value for manually paused downloads void storeDownloadPaused(bool paused); - // Returns the directory that acts as the user's desktop - static OUString getDesktopDirectory(); + // Returns the directory for downloaded files + static OUString getDownloadsDirectory(); // Returns a directory accessible for all users static OUString getAllUsersDirectory(); |