summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-02-18 18:54:43 +0200
committerJan Holesovsky <kendy@collabora.com>2021-01-07 16:32:51 +0100
commit38b8ff986f38428b7f8ac83a1e1cf65c552b3745 (patch)
tree738fbdf5ed922af5da575474bf676b1ca07b46c2 /tools
parent6eb05d036d29f07f489f5cd31691f9510f8998a6 (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')
-rw-r--r--tools/source/stream/strmwnt.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index a0aa5c769b1c..85c6d358fd74 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -315,13 +315,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
);