[Libreoffice-commits] core.git: extensions/source
Takeshi Abe
tabe at fixedpoint.jp
Fri Aug 18 10:59:51 UTC 2017
extensions/source/update/check/updatecheckconfig.cxx | 10 ++++++----
extensions/source/update/check/updatecheckconfig.hxx | 4 ++--
2 files changed, 8 insertions(+), 6 deletions(-)
New commits:
commit fb0bf56948d7f968717f4a3f53ce56e320cd5f36
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Thu Aug 3 01:50:13 2017 +0900
tdf#105538 Download update to Downloads folder on Windows
instead of Desktop.
Change-Id: Ib88b23afdd0b836184b7f0a3f501983137a1405d
Reviewed-on: https://gerrit.libreoffice.org/40692
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
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();
More information about the Libreoffice-commits
mailing list