sfx2/source/doc/guisaveas.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
New commits: commit 5e134896f35d5c3a194090f2af1b84fbaec8b432 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Feb 25 19:17:53 2024 +0600 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Feb 26 02:24:15 2024 +0100 Use SHGetKnownFolderPath, to avoid MAX_PATH limitation Change-Id: If7e70453bd67ec874fc06af7cd53a8c410a24e52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163912 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 5773fc732ea9..974aef7384d9 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1331,14 +1331,15 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) #ifdef _WIN32 if( !bIsInTempPath ) { - wchar_t sPath[MAX_PATH+1]; - HRESULT hRes = SHGetFolderPathW( nullptr, CSIDL_INTERNET_CACHE, nullptr, SHGFP_TYPE_CURRENT, sPath ); + PWSTR sPath; + HRESULT hRes = SHGetKnownFolderPath(FOLDERID_InternetCache, 0, nullptr, &sPath); if( SUCCEEDED(hRes) ) { OUString sTempINetFiles; if( osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(sPath)), sTempINetFiles) == osl::FileBase::E_None ) bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles ); } + CoTaskMemFree(sPath); } #endif // Suggest somewhere other than the system's temp directory