Kaydet (Commit) 5259ab81 authored tarafından Miklos Vajna's avatar Miklos Vajna

sfx2 store: create temp files next to local files

This way it's more likely that we can do a cheap rename instead of a
copy in SfxMedium::Commit().

Change-Id: I45c80cd19c3ab3bc70ecbf9793dbe1bb55994ee9
Reviewed-on: https://gerrit.libreoffice.org/47611Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst a6ec8290
......@@ -3385,7 +3385,18 @@ void SfxMedium::CreateTempFile( bool bReplace )
pImpl->m_aName.clear();
}
pImpl->pTempFile = new ::utl::TempFile();
OUString aLogicBase;
if (comphelper::isFileUrl(pImpl->m_aLogicName))
{
// Try to create the temp file in the same directory.
sal_Int32 nOffset = pImpl->m_aLogicName.lastIndexOf("/");
if (nOffset != -1)
aLogicBase = pImpl->m_aLogicName.copy(0, nOffset);
if (aLogicBase == "file://")
// Doesn't make sense.
aLogicBase.clear();
}
pImpl->pTempFile = new ::utl::TempFile(aLogicBase.isEmpty() ? nullptr : &aLogicBase);
pImpl->pTempFile->EnableKillingFile();
pImpl->m_aName = pImpl->pTempFile->GetFileName();
OUString aTmpURL = pImpl->pTempFile->GetURL();
......
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