summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2013-08-04 09:22:00 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-07 08:20:02 +0000
commitcb021fcafba06ccf973f2abe229a4761c0a002de (patch)
treecb90923365bd311ec708f7121e699be1841fe432 /framework
parentdef99ae60119658d0b24667b08068162d2454694 (diff)
fdo#46037: remove 1 comphelper/configurationhelper in framework
Change-Id: I7c958347297f17875aded7a64526b1673a439ecf Reviewed-on: https://gerrit.libreoffice.org/5271 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/substitutepathvars.cxx50
1 files changed, 15 insertions, 35 deletions
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 1ec4d2d36733..f47ed7bf9f7c 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -41,7 +41,10 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/bootstrap.hxx>
-#include <comphelper/configurationhelper.hxx>
+#include <officecfg/Office/Paths.hxx>
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+
#include <string.h>
@@ -673,23 +676,11 @@ OUString SubstitutePathVariables::ConvertOSLtoUCBURL( const OUString& aOSLCompli
OUString SubstitutePathVariables::GetWorkPath() const
{
- OUString aWorkPath;
-
- try
- {
- ::comphelper::ConfigurationHelper::readDirectKey(
- 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())
+ OUString aWorkPath;
+ css::uno::Reference< css::container::XHierarchicalNameAccess > xPaths(officecfg::Office::Paths::Paths::get(m_xContext), css::uno::UNO_QUERY_THROW);
+ OUString xWork;
+ if (!(xPaths->getByHierarchicalName("['Work']/WritePath") >>= xWork))
+ // fallback in case config layer does not return an useable work dir value.
aWorkPath = GetWorkVariableValue();
return aWorkPath;
@@ -698,27 +689,16 @@ OUString SubstitutePathVariables::GetWorkPath() const
OUString SubstitutePathVariables::GetWorkVariableValue() const
{
OUString aWorkPath;
-
- try
- {
- ::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())
+ boost::optional<OUString> x(officecfg::Office::Paths::Variables::Work::get(m_xContext));
+ if (!x)
{
+ // fallback to $HOME in case platform dependend config layer does not return
+ // an usuable work dir value.
osl::Security aSecurity;
aSecurity.getHomeDir( aWorkPath );
}
+ else
+ aWorkPath = x.get();
return ConvertOSLtoUCBURL( aWorkPath );
}