summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-02 19:44:52 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-21 13:23:24 +0100
commit7ebcea990c725752d40ff9e0de5f5eaa321f25d1 (patch)
tree996033a930763bcaa16205adaefc4e06f8693251 /desktop/source
parent75799dae6e85c1af047ae7051702b7913e2c0f28 (diff)
call PathSettings::initialize after utl::Bootstrap::reloadData
and add setting 'BRAND_BASE_DIR' alongside existing 'UserInstallation' which necessitates moving this block after aAppPath is determined Done so that PathSettings will use the new locations set in bootstrap for UserInstallation directory and not the locations detected during preinit. So autotext can be found relative to the final UserInstallation dir. Change-Id: Ib6dadbec85a380475537027a8ce3972e31089711 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175960 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176905 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx61
1 files changed, 38 insertions, 23 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d6f209c2f1b8..f4e2c39f6d07 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -106,6 +106,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -7986,6 +7987,9 @@ static void preloadData()
// Set user profile's path back to the original one
rtl::Bootstrap::set(u"UserInstallation"_ustr, sUserPath);
+
+ // Note that unotools::Bootstrap has initialized from the temp UserInstallation at this point
+ // see Bootstrap::reloadData for when it gets resynced
}
namespace {
@@ -8177,29 +8181,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if (eStage != PRE_INIT)
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
- if (pUserProfileUrl && eStage != PRE_INIT)
- {
- OUString url(
- pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8);
- OUString path;
- if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path))
- {
- OUString url2;
- osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(
- path, url2);
- if (e == osl::FileBase::E_None)
- url = url2;
- else
- SAL_WARN("lok", "resolving <" << url << "> failed with " << +e);
- }
- rtl::Bootstrap::set(u"UserInstallation"_ustr, url);
- if (eStage == SECOND_INIT)
- {
- comphelper::rng::reseed();
- utl::Bootstrap::reloadData();
- }
- }
-
OUString aAppPath;
if (pAppPath)
{
@@ -8231,6 +8212,40 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if (osl::FileBase::getFileURLFromSystemPath(aAppPath, aAppURL) != osl::FileBase::E_None)
return 0;
+ if (pUserProfileUrl && eStage != PRE_INIT)
+ {
+ OUString url(
+ pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8);
+ OUString path;
+ if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path))
+ {
+ OUString url2;
+ osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(
+ path, url2);
+ if (e == osl::FileBase::E_None)
+ url = url2;
+ else
+ SAL_WARN("lok", "resolving <" << url << "> failed with " << +e);
+ }
+
+ rtl::Bootstrap::set(u"UserInstallation"_ustr, url);
+ rtl::Bootstrap::set(u"BRAND_BASE_DIR"_ustr, aAppURL + "/..");
+ if (eStage == SECOND_INIT)
+ {
+ comphelper::rng::reseed();
+
+ 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
+ uno::Reference<css::util::XPathSettings> xPathSettings = util::thePathSettings::get(xContext);
+ uno::Reference<lang::XInitialization> xReInit(xPathSettings, uno::UNO_QUERY_THROW);
+ xReInit->initialize({});
+ }
+ }
+
#ifdef IOS
// A LibreOffice-using iOS app should have the ICU data file in the app bundle. Initialize ICU
// to use that.