diff options
author | Martin Gallwey <mtg@openoffice.org> | 2001-08-14 16:35:24 +0000 |
---|---|---|
committer | Martin Gallwey <mtg@openoffice.org> | 2001-08-14 16:35:24 +0000 |
commit | f0643d7b72a89a5c70eed59f7079350b91e26be6 (patch) | |
tree | de788b754794a18e8d0e6b012be5e3480bfc8855 /unotools/source/ucbhelper | |
parent | 758fada468dd3cec88cb80a024cb480c7b961a91 (diff) |
#91020# set temp base dir in webtop
Diffstat (limited to 'unotools/source/ucbhelper')
-rw-r--r-- | unotools/source/ucbhelper/XTempFile.hxx | 14 | ||||
-rw-r--r-- | unotools/source/ucbhelper/xtempfile.cxx | 44 |
2 files changed, 46 insertions, 12 deletions
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 <cppuhelper/weak.hxx> #endif -#ifndef _UNOTOOLS_TEMPFILE_HXX -#include <unotools/tempfile.hxx> -#endif #ifndef _OSL_MUTEX_HXX_ #include <osl/mutex.hxx> #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 <com/sun/star/registry/XRegistryKey.hpp> #endif +#ifndef _UNOTOOLS_TEMPFILE_HXX +#include <unotools/tempfile.hxx> +#endif +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif +#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX +#include <svtools/pathoptions.hxx> +#endif +#ifndef _UTL_CONFIGMGR_HXX_ +#include <unotools/configmgr.hxx> +#endif +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#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 |