[Libreoffice-commits] core.git: sfx2/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 9 08:10:03 UTC 2018
sfx2/source/doc/docfile.cxx | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
New commits:
commit 2157a3536f97ff5ae7c82611a801fef7e3708983
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 8 16:49:25 2018 +0100
sfx2 store: try rename before copying
Rename is cheaper then copying the content over manually, so try that
first.
Change-Id: Ieb1d03e39501c1565dae7e3290e318a09ee18965
Reviewed-on: https://gerrit.libreoffice.org/47612
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 3ca1d1a2d2f9..2e4ac54ba75c 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1721,29 +1721,36 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
try
{
- if( bOverWrite && ::utl::UCBContentHelper::IsDocument( aDest.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ) )
+ OUString aSourceMainURL = aSource.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+ OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+ if (comphelper::isFileUrl(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None)
+ bResult = true;
+ else
{
- if( pImpl->m_aBackupURL.isEmpty() )
- DoInternalBackup_Impl( aOriginalContent );
+ if (bOverWrite && ::utl::UCBContentHelper::IsDocument(aDestMainURL))
+ {
+ if( pImpl->m_aBackupURL.isEmpty() )
+ DoInternalBackup_Impl( aOriginalContent );
- if( !pImpl->m_aBackupURL.isEmpty() )
+ if( !pImpl->m_aBackupURL.isEmpty() )
+ {
+ Reference< XInputStream > aTempInput = aTempCont.openStream();
+ bTransactStarted = true;
+ aOriginalContent.setPropertyValue( "Size", uno::makeAny( (sal_Int64)0 ) );
+ aOriginalContent.writeStream( aTempInput, bOverWrite );
+ bResult = true;
+ }
+ else
+ {
+ pImpl->m_eError = ERRCODE_SFX_CANTCREATEBACKUP;
+ }
+ }
+ else
{
Reference< XInputStream > aTempInput = aTempCont.openStream();
- bTransactStarted = true;
- aOriginalContent.setPropertyValue( "Size", uno::makeAny( (sal_Int64)0 ) );
aOriginalContent.writeStream( aTempInput, bOverWrite );
bResult = true;
}
- else
- {
- pImpl->m_eError = ERRCODE_SFX_CANTCREATEBACKUP;
- }
- }
- else
- {
- Reference< XInputStream > aTempInput = aTempCont.openStream();
- aOriginalContent.writeStream( aTempInput, bOverWrite );
- bResult = true;
}
}
catch ( const css::ucb::CommandAbortedException& )
More information about the Libreoffice-commits
mailing list