diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-06-12 14:31:45 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-06-21 00:45:53 +0200 |
commit | 7795a2adc0a724220440dca997495043902f1384 (patch) | |
tree | 3afa5eed56d5a31abfdf985666bb1719bdc5165f /cui | |
parent | 27e1c198a504deb4634f5f6673a77b5944c9f8cc (diff) |
Allow bootstrap variables in Java user classpath settings, 2nd try
Add a second mode: When a classpath starts with '$', bootstrap variables are recognized.
The classpath must then be provided as URL, not native path.
Change-Id: Idcc229a2b4e9a512b0e712ea932a6e4293907db3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152899
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optjava.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index c1528138f326..17f128ce9b3b 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -33,6 +33,7 @@ #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> +#include <rtl/bootstrap.hxx> #include <strings.hrc> #include <vcl/svapp.hxx> @@ -941,16 +942,22 @@ void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath ) m_xPathList->clear(); if (!_rPath.isEmpty()) { - sal_Int32 nIdx = 0; - do + std::vector paths = jfw_convertUserPathList(_rPath); + for (auto const& path : paths) { - OUString sToken = _rPath.getToken( 0, CLASSPATH_DELIMITER, nIdx ); OUString sURL; - osl::FileBase::getFileURLFromSystemPath(sToken, sURL); // best effort + if (path.startsWith("$")) + { + sURL = path; + rtl::Bootstrap::expandMacros(sURL); + } + else + { + osl::FileBase::getFileURLFromSystemPath(path, sURL); + } INetURLObject aURL( sURL ); - m_xPathList->append("", sToken, SvFileInformationManager::GetImageId(aURL)); + m_xPathList->append("", path, SvFileInformationManager::GetImageId(aURL)); } - while (nIdx>=0); // select first entry m_xPathList->select(0); } |