summaryrefslogtreecommitdiff
path: root/cui/source/options
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-05-25 13:41:16 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-05-25 16:19:00 +0200
commitcfc2376f804f13eb562f39182cb24fe7dc61d6ef (patch)
tree7f1595db0a7bba9118db7b3e69b327b47f65fc75 /cui/source/options
parent21473f46fda5f1c7f220493667a96fff7c78a7b3 (diff)
Allow bootstrap variables in Java user classpath settings
This allows for relative paths to be configured as Java class path. Change-Id: Ie3e6bc3836fb316457e5c9f11dfb77d2fcd49ad4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152271 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'cui/source/options')
-rw-r--r--cui/source/options/optjava.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index c1528138f326..631d085c3bfb 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -944,13 +944,30 @@ void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
sal_Int32 nIdx = 0;
do
{
- OUString sToken = _rPath.getToken( 0, CLASSPATH_DELIMITER, nIdx );
+ sal_Int32 nextColon = _rPath.indexOf(CLASSPATH_DELIMITER, nIdx);
+ OUString sToken(
+ _rPath.subView(nIdx, nextColon > 0 ? nextColon - nIdx : _rPath.getLength() - nIdx));
+
+ // Detect open bootstrap variables - they might contain colons - we need to skip those.
+ sal_Int32 nBootstrapVarStart = sToken.indexOf("${");
+ if (nBootstrapVarStart >= 0)
+ {
+ sal_Int32 nBootstrapVarEnd = sToken.indexOf("}");
+ if (nBootstrapVarEnd == -1)
+ {
+ // Current colon is part of bootstrap variable - skip it!
+ nextColon = _rPath.indexOf(CLASSPATH_DELIMITER, nextColon + 1);
+ sToken = _rPath.subView(nIdx, nextColon > 0 ? nextColon - nIdx
+ : _rPath.getLength() - nIdx);
+ }
+ }
OUString sURL;
osl::FileBase::getFileURLFromSystemPath(sToken, sURL); // best effort
INetURLObject aURL( sURL );
m_xPathList->append("", sToken, SvFileInformationManager::GetImageId(aURL));
+ nIdx = nextColon + 1;
}
- while (nIdx>=0);
+ while (nIdx > 0);
// select first entry
m_xPathList->select(0);
}