From aed4e00c4f5788253d68502f7d957dbb08f4555b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 2 Nov 2024 20:37:02 +0000 Subject: UserInstallation may change in kit-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So the setting fetched at ctor time for UserInstallation (and BRAND_BASE_DIR) may no longer be true, so expanding variables based on those earlier seen values results in unwanted paths. add XInitialization to SubstitutePathVariables (like done for PathSettings) to allow reiniting these explicitly once. Change-Id: Ia930ea71cb09adc91d6d47ee047c44b24222e8a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175961 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 410f6b50eb44276b1d2095c844244ef4d0ddefaa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177109 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/source/lib/init.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'desktop/source') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f4e2c39f6d07..4842a9732cee 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -107,6 +107,7 @@ #include #include #include +#include #include #include #include @@ -8237,12 +8238,20 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char utl::Bootstrap::reloadData(); // Now that bootstrap User/Shared installation paths have been (re)set to the final - // location, reinitialize the PathSettings so $(userurl)/$(instdir) path variables - // will be expanded using these newly set paths and not the paths detected during - // preinit which used unorthodox throwaway temp locations + // location, reinitialize the PathSubstitution rules and PathSettings so that + // $(userurl)/$(instdir) path variables will be expanded using these newly set + // paths and not the paths detected during preinit which used unorthodox throwaway + // temp locations + + // First reinitialize the PathSubstitution rules + uno::Reference xPathSubst(util::PathSubstitution::create(xContext)); + uno::Reference xReInitSubstitution(xPathSubst, uno::UNO_QUERY_THROW); + xReInitSubstitution->initialize({}); + + // PathSettings depend on PathSubstitution rules uno::Reference xPathSettings = util::thePathSettings::get(xContext); - uno::Reference xReInit(xPathSettings, uno::UNO_QUERY_THROW); - xReInit->initialize({}); + uno::Reference xReInitSettings(xPathSettings, uno::UNO_QUERY_THROW); + xReInitSettings->initialize({}); } } -- cgit