[Libreoffice-commits] core.git: framework/source
Julien Nabet
serval2412 at yahoo.fr
Wed Aug 7 01:23:52 PDT 2013
framework/source/services/substitutepathvars.cxx | 50 ++++++-----------------
1 file changed, 15 insertions(+), 35 deletions(-)
New commits:
commit cb021fcafba06ccf973f2abe229a4761c0a002de
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sun Aug 4 09:22:00 2013 +0200
fdo#46037: remove 1 comphelper/configurationhelper in framework
Change-Id: I7c958347297f17875aded7a64526b1673a439ecf
Reviewed-on: https://gerrit.libreoffice.org/5271
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 1ec4d2d..f47ed7b 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 );
}
More information about the Libreoffice-commits
mailing list