Kaydet (Commit) e061f90a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/50494Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 0d265703
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment