vcl/source/gdi/embeddedfontshelper.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit 11ee608f8d3aaab5c278089ca2c61b010f28d79a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Aug 9 16:53:03 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Aug 9 15:40:44 2025 +0200 Make GetEmbeddedFontsRoot return normalized URL A call to getAbsoluteFileURL resolves all the /../ segments; and making the value static avoids repeated creation of the string. Change-Id: I19f7813be1f457ecf6cc8cc379c16794b272b0f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189258 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index b18ba402e3d7..0f69a1cd0ad2 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -45,11 +45,16 @@ using namespace vcl; namespace { -OUString GetEmbeddedFontsRoot() +const OUString& GetEmbeddedFontsRoot() { - OUString path = u"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"_ustr; - rtl::Bootstrap::expandMacros( path ); - return path + "/user/temp/embeddedfonts/"; + static const OUString path = []() + { + OUString p = u"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") "::UserInstallation}"_ustr; + rtl::Bootstrap::expandMacros(p); + osl::FileBase::getAbsoluteFileURL({}, p + "/user/temp/embeddedfonts/", p); + return p; + }(); + return path; } } @@ -69,7 +74,7 @@ static void clearDir( const OUString& path ) void EmbeddedFontsHelper::clearTemporaryFontFiles() { - OUString path = GetEmbeddedFontsRoot(); + const OUString& path = GetEmbeddedFontsRoot(); clearDir( path + "fromdocs/" ); clearDir( path + "fromsystem/" ); }