diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-02-28 10:48:41 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-02-28 15:08:06 +0100 |
commit | e061f90a77f43a7f32a0f5df3768650cfab9b748 (patch) | |
tree | 256d6ef78c3368a10f43296682ea6cac071cc849 /desktop | |
parent | 0d26570365e81ee65701b89e1d4121c04fbb813f (diff) |
Clean up Desktop::CreateTemporaryDirectory
...avoiding the confusing, and apparently unnecessary back-and-forth between
system path and file URL. (Superseding
<https://gerrit.libreoffice.org/#/c/50422/> "Don't overwrite system temppath
with old one that failed already".)
Change-Id: I247982a40d54565f5c98bda9a36209cba83c5c9f
Reviewed-on: https://gerrit.libreoffice.org/50494
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/appinit.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 826c525eb6c1..2aec3928ad87 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -252,26 +252,19 @@ void Desktop::CreateTemporaryDirectory() if ( aTempBaseURL.endsWith( "/" ) ) aTempBaseURL = aTempBaseURL.copy( 0, aTempBaseURL.getLength() - 1 ); - OUString aRet; - OUString aTempPath( aTempBaseURL ); - // create new current temporary directory - osl::FileBase::getSystemPathFromFileURL( aTempBaseURL, aRet ); - ::osl::FileBase::getFileURLFromSystemPath( aRet, aTempPath ); - aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempPath ); - if ( aTempPath.isEmpty() ) + OUString aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempBaseURL ); + if ( aTempPath.isEmpty() + && ::osl::File::getTempDirURL( aTempBaseURL ) == osl::FileBase::E_None ) { - ::osl::File::getTempDirURL( aTempBaseURL ); - if ( aTempBaseURL.endsWith( "/" ) ) aTempBaseURL = aTempBaseURL.copy( 0, aTempBaseURL.getLength() - 1 ); - aTempPath = aTempBaseURL; - ::osl::FileBase::getFileURLFromSystemPath( aRet, aTempPath ); - aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempPath ); + aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempBaseURL ); } // set new current temporary directory + OUString aRet; if (osl::FileBase::getFileURLFromSystemPath( aTempPath, aRet ) != osl::FileBase::E_None) { |