diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-03 12:17:54 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-03 12:31:33 +0200 |
commit | 68e2b820489f01c38106a606740ef746c0cf4c9f (patch) | |
tree | 25ae7d1396ca4d4511cd919fe40dfcef98617d65 /sal/osl/w32 | |
parent | c0a8725da1108604510b7d6a330fa673cba31a5d (diff) |
Allow custom "eye catcher" from LO_TESTNAME in tempfiles on Windows
Change-Id: Id8d94af9e03d0c8553d0a7949e4a9259159481cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165732
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal/osl/w32')
-rw-r--r-- | sal/osl/w32/tempfile.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx index f0065bf2d8ef..30f879573de4 100644 --- a/sal/osl/w32/tempfile.cxx +++ b/sal/osl/w32/tempfile.cxx @@ -85,6 +85,20 @@ static oslFileError osl_setup_createTempFile_impl_( return osl_error; } +static LPCWSTR getEyeCatcher() +{ + static const OUString sEyeCatcher = [] + { + OUString eyeCatcher = u"\0"_ustr; +#ifdef DBG_UTIL + if (const wchar_t* eye = _wgetenv(L"LO_TESTNAME")) + eyeCatcher = OUString(o3tl::toU(eye), wcslen(eye) + 1); // including terminating nul +#endif + return eyeCatcher; + }(); + return o3tl::toW(sEyeCatcher.getStr()); +} + static oslFileError osl_win32_GetTempFileName_impl_( rtl_uString* base_directory, LPWSTR temp_file_name) { @@ -92,7 +106,7 @@ static oslFileError osl_win32_GetTempFileName_impl_( if (GetTempFileNameW( o3tl::toW(rtl_uString_getStr(base_directory)), - L"", + getEyeCatcher(), 0, temp_file_name) == 0) { |