From f0643d7b72a89a5c70eed59f7079350b91e26be6 Mon Sep 17 00:00:00 2001 From: Martin Gallwey Date: Tue, 14 Aug 2001 16:35:24 +0000 Subject: #91020# set temp base dir in webtop --- unotools/source/ucbhelper/XTempFile.hxx | 14 +++++------ unotools/source/ucbhelper/xtempfile.cxx | 44 ++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 12 deletions(-) (limited to 'unotools') diff --git a/unotools/source/ucbhelper/XTempFile.hxx b/unotools/source/ucbhelper/XTempFile.hxx index dc6928858906..40c76fb8ff90 100644 --- a/unotools/source/ucbhelper/XTempFile.hxx +++ b/unotools/source/ucbhelper/XTempFile.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XTempFile.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mtg $ $Date: 2001-08-01 12:56:13 $ + * last change: $Author: mtg $ $Date: 2001-08-14 17:33:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,14 +79,12 @@ #ifndef _CPPUHELPER_WEAK_HXX_ #include #endif -#ifndef _UNOTOOLS_TEMPFILE_HXX -#include -#endif #ifndef _OSL_MUTEX_HXX_ #include #endif class SvStream; +namespace utl { class TempFile; } class XTempFile : public com::sun::star::io::XInputStream, public com::sun::star::io::XOutputStream, @@ -94,9 +92,9 @@ class XTempFile : public com::sun::star::io::XInputStream, public cppu::OWeakObject { protected: - ::utl::TempFile maTempFile; - ::osl::Mutex maMutex; - SvStream* mpStream; + ::utl::TempFile* mpTempFile; + ::osl::Mutex maMutex; + SvStream* mpStream; void checkError () const; void checkConnected () const; diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index e96a289a7f93..3cb76b667e61 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xtempfile.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mtg $ $Date: 2001-08-01 12:59:20 $ + * last change: $Author: mtg $ $Date: 2001-08-14 17:35:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,22 @@ #ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP #include #endif +#ifndef _UNOTOOLS_TEMPFILE_HXX +#include +#endif +#ifndef _OSL_FILE_HXX_ +#include +#endif +#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX +#include +#endif +#ifndef _UTL_CONFIGMGR_HXX_ +#include +#endif +#ifndef _URLOBJ_HXX +#include +#endif + using com::sun::star::registry::XRegistryKey; using com::sun::star::registry::InvalidRegistryException; @@ -89,14 +105,34 @@ using com::sun::star::lang::XMultiServiceFactory; using com::sun::star::lang::XSingleServiceFactory; using cppu::OWeakObject; using rtl::OUString; +using osl::FileBase; +using utl::TempFile; +using namespace utl; + +// copy define from desktop\source\app\appinit.cxx + +#define DESKTOP_TEMPNAMEBASE_DIR "/temp/soffice.tmp" XTempFile::XTempFile () { - maTempFile.EnableKillingFile ( sal_True ); - mpStream = maTempFile.GetStream ( STREAM_STD_READWRITE ); + if ( ! TempFile::GetTempNameBaseDirectory().Len()) + { + OUString aUserPath, aTmp; + ConfigManager* pCfgMgr = ConfigManager::GetConfigManager(); + Any aAny = pCfgMgr->GetDirectConfigProperty( ConfigManager::INSTALLPATH ); + aAny >>= aUserPath; + + aUserPath += OUString ( RTL_CONSTASCII_USTRINGPARAM (DESKTOP_TEMPNAMEBASE_DIR ) ); + FileBase::getFileURLFromSystemPath( aUserPath, aTmp ); + TempFile::SetTempNameBaseDirectory( aTmp ); + } + mpTempFile = new TempFile; + mpTempFile->EnableKillingFile ( sal_True ); + mpStream = mpTempFile->GetStream ( STREAM_STD_READWRITE ); } XTempFile::~XTempFile () { + delete mpTempFile; } // XInterface -- cgit v1.2.3