diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-26 20:52:52 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-26 20:52:52 +0100 | 
| commit | 0d9645b2506d7795c689c2f2586818a3b96281d0 (patch) | |
| tree | c511c66124455631a8793329b2a09e44bb0f634f | |
| parent | Updates to dependency scanner based on real world data (diff) | |
| download | gentoobrowse-api-0d9645b2506d7795c689c2f2586818a3b96281d0.tar.bz2 gentoobrowse-api-0d9645b2506d7795c689c2f2586818a3b96281d0.tar.xz gentoobrowse-api-0d9645b2506d7795c689c2f2586818a3b96281d0.zip | |
Always remove tmp dir after scan regardless of successfulness
| -rw-r--r-- | gentoobrowse-api/service/maintenanceimpl.cpp | 6 | 
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()); | 
