Kaydet (Commit) a0b5ba2e authored tarafından Michael Meeks's avatar Michael Meeks

re-open output file on save to fsync to improve first-start performance

üst c9f30fa2
...@@ -1912,9 +1912,20 @@ void SfxMedium::Transfer_Impl() ...@@ -1912,9 +1912,20 @@ void SfxMedium::Transfer_Impl()
xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
Reference< ::com::sun::star::ucb::XProgressHandler >() ); 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 ); 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 else
{ {
......
...@@ -1909,10 +1909,6 @@ shell::write( sal_Int32 CommandId, ...@@ -1909,10 +1909,6 @@ shell::write( sal_Int32 CommandId,
} }
} while( nReadBytes == nRequestedBytes ); } while( nReadBytes == nRequestedBytes );
aFile.sync(); // fsync / flush it to disk.
OSL_TRACE( "fsync'd file '%s'\n",
rtl::OUStringToOString( aUnqPath, RTL_TEXTENCODING_UTF8 ).getStr() );
err = aFile.close(); err = aFile.close();
if( err != osl::FileBase::E_None ) if( err != osl::FileBase::E_None )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment