summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp
index 4ac065c..d5c6b64 100644
--- a/gentoobrowse-api/service/maintenanceimpl.cpp
+++ b/gentoobrowse-api/service/maintenanceimpl.cpp
@@ -3,6 +3,7 @@
#include <tablepatch.h>
#include <sqlWriter.h>
#include <buffer.h>
+#include <scopeExit.h>
#include <boost/filesystem/operations.hpp>
#include <sql/maintenance/createTempFileListTable.sql.h>
#include <sql/maintenance/fileList.sql.h>
@@ -172,7 +173,6 @@ namespace Gentoo {
for (const auto & fp : fps) {
fp.second->apply(dbc);
}
- boost::filesystem::remove_all(tmp);
dbc->execute("DROP TABLE filelist");
for (const auto & fp : fps) {
fp.second->tidy(dbc);
@@ -183,6 +183,10 @@ namespace Gentoo {
Maintenance::refreshPackageTree(const Ice::Current &)
{
auto tmp = boost::filesystem::temp_directory_path() / "import";
+ AdHoc::ScopeExit([&tmp]{
+ boost::system::error_code ec;
+ boost::filesystem::remove_all(tmp, ec);
+ });
auto dbc = db->get();
dbc->execute("SET search_path = gentoobrowse, pg_catalog");
DB::TransactionScope tx(dbc.get());