From 4743a32b4f991c57e4b8a66adf035b1808ca793a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 18 May 2022 12:27:59 +0200 Subject: only need to create the folder for temp files once Change-Id: I805203dc51ca85515150fe0f28fc6464c45453c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134523 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/ucbhelper/tempfile.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'unotools/source') diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index e912c609337b..83a523a2bd9b 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -142,19 +142,18 @@ static OUString ConstructTempDir_Impl( const OUString* pParent, bool bCreatePare if ( aName.isEmpty() ) { - OUString &rTempNameBase_Impl = gTempNameBase_Impl; - if (rTempNameBase_Impl.isEmpty()) + if (gTempNameBase_Impl.isEmpty()) { OUString ustrTempDirURL; ::osl::FileBase::RC rc = ::osl::File::getTempDirURL( ustrTempDirURL ); if (rc == ::osl::FileBase::E_None) - rTempNameBase_Impl = ustrTempDirURL; + gTempNameBase_Impl = ustrTempDirURL; + ensuredir( aName ); } // if no parent or invalid parent : use default directory - DBG_ASSERT( !rTempNameBase_Impl.isEmpty(), "No TempDir!" ); - aName = rTempNameBase_Impl; - ensuredir( aName ); + DBG_ASSERT( !gTempNameBase_Impl.isEmpty(), "No TempDir!" ); + aName = gTempNameBase_Impl; } // Make sure that directory ends with a separator -- cgit