diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-10-10 17:57:15 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-10-11 00:28:48 +0200 |
commit | 6c2cffdfc634be8ef7ec37f7da4a4b16e5e2a04e (patch) | |
tree | a5c81acf15a3ea969cfcf249aeb206336d88f54e /connectivity | |
parent | f0215dcc9e5ba47d4b7d5b9759f1bd774942d388 (diff) |
connectivity: firebird: recursively delete temp directories
TempFile itself will only remove empty directories.
Change-Id: Ibaf986856bde172de40686ae363821b19add8106
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/Driver.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Driver.hxx | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx index a6eacc634843..5c9c88be5e9d 100644 --- a/connectivity/source/drivers/firebird/Driver.cxx +++ b/connectivity/source/drivers/firebird/Driver.cxx @@ -31,6 +31,7 @@ #include <osl/process.h> #include <rtl/bootstrap.hxx> #include <svtools/miscopt.hxx> +#include <unotools/localfilehelper.hxx> using namespace com::sun::star; using namespace com::sun::star::uno; @@ -67,8 +68,11 @@ FirebirdDriver::FirebirdDriver(const ::com::sun::star::uno::Reference< ::com::su , m_firebirdTMPDirectory(NULL, true) , m_firebirdLockDirectory(NULL, true) { - m_firebirdTMPDirectory.EnableKillingFile(); - m_firebirdLockDirectory.EnableKillingFile(); + // Note: TempFile caches the URL on first access; call this here so that + // ~FirebirdDriver is not the first access, because that is called + // when the ServiceManager is disposing, so GetURL() would fail! + m_firebirdTMPDirectory.GetURL(); + m_firebirdLockDirectory.GetURL(); // ::utl::TempFile uses a unique temporary directory (subdirectory of // /tmp or other user specific tmp directory) per instance in which @@ -91,6 +95,12 @@ FirebirdDriver::FirebirdDriver(const ::com::sun::star::uno::Reference< ::com::su #endif } +FirebirdDriver::~FirebirdDriver() +{ + utl::removeTree(m_firebirdTMPDirectory.GetURL()); + utl::removeTree(m_firebirdLockDirectory.GetURL()); +} + void FirebirdDriver::disposing() { MutexGuard aGuard(m_aMutex); diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx index e7ff86cbc30d..2ed77a0a9463 100644 --- a/connectivity/source/drivers/firebird/Driver.hxx +++ b/connectivity/source/drivers/firebird/Driver.hxx @@ -63,6 +63,7 @@ namespace connectivity public: FirebirdDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); + virtual ~FirebirdDriver(); const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; } // OComponentHelper |