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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -185,7 +185,10 @@ javaFrameworkError jfw_startVM(
|
||||
return JFW_E_NEED_RESTART;
|
||||
|
||||
vmParams = settings.getVmParametersUtf8();
|
||||
sUserClassPath = jfw::makeClassPathOption(settings.getUserClassPath());
|
||||
// Expand user classpath (might contain bootstrap vars)
|
||||
OUString sUserPath(settings.getUserClassPath());
|
||||
rtl::Bootstrap::expandMacros(sUserPath);
|
||||
sUserClassPath = jfw::makeClassPathOption(sUserPath);
|
||||
} // end mode FWK_MODE_OFFICE
|
||||
else if (mode == jfw::JFW_MODE_DIRECT)
|
||||
{
|
||||
|
Reference in New Issue
Block a user