summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-04-15 03:33:22 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-04-15 03:34:14 +0200
commita0b5ba2e821091b8053bfc1d2f9c99aca7431907 (patch)
tree583fd8424dbc23ad9d5f22bc17817f68ad9d5b57 /sfx2
parentc9f30fa2c913b4349a1b6cb6e6e3a11ee3a26521 (diff)
re-open output file on save to fsync to improve first-start performance
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 0f30aab012b7..ced19509f503 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1912,9 +1912,20 @@ void SfxMedium::Transfer_Impl()
xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
Reference< ::com::sun::star::ucb::XProgressHandler >() );
- if ( ::utl::LocalFileHelper::IsLocalFile( aDest.GetMainURL( INetURLObject::NO_DECODE ) ) || !aDest.removeSegment() )
+ rtl::OUString aDestURL( aDest.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( ::utl::LocalFileHelper::IsLocalFile( aDestURL ) || !aDest.removeSegment() )
{
TransactedTransferForFS_Impl( aSource, aDest, xComEnv );
+
+ // Hideous - no clean way to do this, so we re-open the file just to fsync it
+ osl::File aFile( aDestURL );
+ if ( aFile.open( osl_File_OpenFlag_Write ) == osl::FileBase::E_None )
+ {
+ aFile.sync();
+ OSL_TRACE("fsync'd saved file '%s'\n",
+ rtl::OUStringToOString( aDestURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aFile.close();
+ }
}
else
{