Kaydet (Commit) cb021fca authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Miklos Vajna

fdo#46037: remove 1 comphelper/configurationhelper in framework

Change-Id: I7c958347297f17875aded7a64526b1673a439ecf
Reviewed-on: https://gerrit.libreoffice.org/5271Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst def99ae6
...@@ -41,7 +41,10 @@ ...@@ -41,7 +41,10 @@
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#include <comphelper/configurationhelper.hxx> #include <officecfg/Office/Paths.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <string.h> #include <string.h>
...@@ -673,23 +676,11 @@ OUString SubstitutePathVariables::ConvertOSLtoUCBURL( const OUString& aOSLCompli ...@@ -673,23 +676,11 @@ OUString SubstitutePathVariables::ConvertOSLtoUCBURL( const OUString& aOSLCompli
OUString SubstitutePathVariables::GetWorkPath() const OUString SubstitutePathVariables::GetWorkPath() const
{ {
OUString aWorkPath; OUString aWorkPath;
css::uno::Reference< css::container::XHierarchicalNameAccess > xPaths(officecfg::Office::Paths::Paths::get(m_xContext), css::uno::UNO_QUERY_THROW);
try OUString xWork;
{ if (!(xPaths->getByHierarchicalName("['Work']/WritePath") >>= xWork))
::comphelper::ConfigurationHelper::readDirectKey( // fallback in case config layer does not return an useable work dir value.
m_xContext,
OUString("org.openoffice.Office.Paths"),
OUString("Paths/Work"),
OUString("WritePath"),
::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
}
catch(const RuntimeException &)
{
}
// fallback in case config layer does not return an useable work dir value.
if (aWorkPath.isEmpty())
aWorkPath = GetWorkVariableValue(); aWorkPath = GetWorkVariableValue();
return aWorkPath; return aWorkPath;
...@@ -698,27 +689,16 @@ OUString SubstitutePathVariables::GetWorkPath() const ...@@ -698,27 +689,16 @@ OUString SubstitutePathVariables::GetWorkPath() const
OUString SubstitutePathVariables::GetWorkVariableValue() const OUString SubstitutePathVariables::GetWorkVariableValue() const
{ {
OUString aWorkPath; OUString aWorkPath;
boost::optional<OUString> x(officecfg::Office::Paths::Variables::Work::get(m_xContext));
try if (!x)
{
::comphelper::ConfigurationHelper::readDirectKey(
m_xContext,
OUString("org.openoffice.Office.Paths"),
OUString("Variables"),
OUString("Work"),
::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
}
catch(const RuntimeException &)
{
}
// fallback to $HOME in case platform dependend config layer does not return
// an usuable work dir value.
if (aWorkPath.isEmpty())
{ {
// fallback to $HOME in case platform dependend config layer does not return
// an usuable work dir value.
osl::Security aSecurity; osl::Security aSecurity;
aSecurity.getHomeDir( aWorkPath ); aSecurity.getHomeDir( aWorkPath );
} }
else
aWorkPath = x.get();
return ConvertOSLtoUCBURL( aWorkPath ); return ConvertOSLtoUCBURL( aWorkPath );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment