diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-02-18 18:54:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-19 09:14:31 +0100 |
commit | 27960861a66d13a3f0bb3ff8503bc9fdb53745da (patch) | |
tree | 3c8a44a66de75c2756dcea7a36835d4bbd0bd43e /tools/source | |
parent | fcc30680ee7ac7d2bf9ec4ccdae7256b61ad7102 (diff) |
use FILE_ATTRIBUTE_TEMPORARY on Windows for temp files
which acts as a hint to the OS that these files do not
need persistent storage.
If there is sufficient system RAM, these files will never
even hit disk.
Change-Id: I25b83aad67fda58ec39cead8bd1eb038892d3cde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88124
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/stream/strmwnt.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx index 23fa71526447..d85ce3a0c372 100644 --- a/tools/source/stream/strmwnt.cxx +++ b/tools/source/stream/strmwnt.cxx @@ -300,13 +300,18 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode ) nOpenAction = OPEN_EXISTING; } + DWORD nAttributes = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS; + + if ( nMode & StreamMode::TEMPORARY ) + nAttributes |= FILE_ATTRIBUTE_TEMPORARY; + pInstanceData->hFile = CreateFileW( o3tl::toW(aFilename.getStr()), nAccessMode, nShareMode, nullptr, nOpenAction, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + nAttributes, nullptr ); |