summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-08-18 15:24:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-08-18 15:32:15 +0200
commit7f8a4db4e387cbbde7cbcd9bd4d341817c0669cc (patch)
tree9a89d84e9348a0e23e778eea61a5ad6f22a1ef92 /unotools
parent1ce99678e5647076da3c152f0b7350e5ddd410e4 (diff)
Simplify from ucbhelper::getSystemPathFromFileURL & v. v. to osl::FileBase
(vnd.sun.star.wfs is long gone); pending further clean up Change-Id: Ie532c1d945c20a31f7758fbc0438e6b1f5d5c843
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/ucbhelper/localfilehelper.cxx76
1 files changed, 21 insertions, 55 deletions
diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx
index d5ff1e4ef5e5..3efc99b7ee36 100644
--- a/unotools/source/ucbhelper/localfilehelper.cxx
+++ b/unotools/source/ucbhelper/localfilehelper.cxx
@@ -20,11 +20,9 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
-#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <comphelper/processfactory.hxx>
#include <sal/log.hxx>
#include <unotools/localfilehelper.hxx>
-#include <ucbhelper/fileidentifierconverter.hxx>
#include <rtl/ustring.hxx>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
@@ -38,76 +36,44 @@ using namespace ::com::sun::star::ucb;
namespace utl
{
-bool LocalFileHelper::ConvertSystemPathToURL( const OUString& rName, const OUString& rBaseURL, OUString& rReturn )
+bool LocalFileHelper::ConvertSystemPathToURL( const OUString& rName, const OUString&, OUString& rReturn )
{
- rReturn.clear();
-
- Reference< XUniversalContentBroker > pBroker(
- UniversalContentBroker::create(
- comphelper::getProcessComponentContext() ) );
- try
- {
- rReturn = ::ucbhelper::getFileURLFromSystemPath( pBroker, rBaseURL, rName );
+ bool ok = osl::FileBase::getFileURLFromSystemPath(rName, rReturn)
+ == osl::FileBase::E_None;
+ if (!ok) {
+ rReturn.clear();
}
- catch ( ::com::sun::star::uno::RuntimeException& )
- {
- return false;
- }
-
- return !rReturn.isEmpty();
+ return ok;
}
bool LocalFileHelper::ConvertURLToSystemPath( const OUString& rName, OUString& rReturn )
{
- rReturn.clear();
- Reference< XUniversalContentBroker > pBroker(
- UniversalContentBroker::create(
- comphelper::getProcessComponentContext() ) );
- try
- {
- rReturn = ::ucbhelper::getSystemPathFromFileURL( pBroker, rName );
+ bool ok = osl::FileBase::getSystemPathFromFileURL(rName, rReturn)
+ == osl::FileBase::E_None;
+ if (!ok) {
+ rReturn.clear();
}
- catch ( ::com::sun::star::uno::RuntimeException& )
- {
- }
-
- return !rReturn.isEmpty();
+ return ok;
}
bool LocalFileHelper::ConvertPhysicalNameToURL(const OUString& rName, OUString& rReturn)
{
- rReturn.clear();
- Reference< XUniversalContentBroker > pBroker(
- UniversalContentBroker::create(
- comphelper::getProcessComponentContext() ) );
- try
- {
- rReturn = ::ucbhelper::getFileURLFromSystemPath( pBroker, "file:///", rName );
+ bool ok = osl::FileBase::getFileURLFromSystemPath(rName, rReturn)
+ == osl::FileBase::E_None;
+ if (!ok) {
+ rReturn.clear();
}
- catch (const ::com::sun::star::uno::RuntimeException&)
- {
- }
-
- return !rReturn.isEmpty();
+ return ok;
}
bool LocalFileHelper::ConvertURLToPhysicalName(const OUString& rName, OUString& rReturn)
{
- rReturn.clear();
- Reference< XUniversalContentBroker > pBroker(
- UniversalContentBroker::create(
- comphelper::getProcessComponentContext() ) );
- try
- {
- INetURLObject aObj( rName );
- if ( aObj.GetProtocol() == INetProtocol::File )
- rReturn = ::ucbhelper::getSystemPathFromFileURL( pBroker, rName );
+ bool ok = osl::FileBase::getSystemPathFromFileURL(rName, rReturn)
+ == osl::FileBase::E_None;
+ if (!ok) {
+ rReturn.clear();
}
- catch (const ::com::sun::star::uno::RuntimeException&)
- {
- }
-
- return !rReturn.isEmpty();
+ return ok;
}
bool LocalFileHelper::IsLocalFile(const OUString& rName)