allpy
changeset 522:bc3990b43e39
blocks3d/wt: store all tempfiles from history
Previously tempfiles were removed after new task started.
User could click at previous files and see error message.
Currently all temp_dirs are stored in list
and removed in widget destructor.
author | boris (kodomo) <bnagaev@gmail.com> |
---|---|
date | Sat, 26 Feb 2011 19:26:13 +0300 |
parents | a3df15a42f9d |
children | bc54037a5cb5 |
files | blocks3d/wt/blocks3d-wt-widget.C blocks3d/wt/blocks3d-wt-widget.h |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line diff
1.1 --- a/blocks3d/wt/blocks3d-wt-widget.C Sat Feb 26 18:06:45 2011 +0300 1.2 +++ b/blocks3d/wt/blocks3d-wt-widget.C Sat Feb 26 19:26:13 2011 +0300 1.3 @@ -2,6 +2,7 @@ 1.4 #include <fstream> 1.5 #include <iostream> 1.6 #include <boost/format.hpp> 1.7 +#include <boost/foreach.hpp> 1.8 #include <cstdlib> 1.9 #include <list> 1.10 #include <string> 1.11 @@ -224,7 +225,6 @@ 1.12 return; 1.13 } 1.14 1.15 - drop_tempfiles(); 1.16 { 1.17 char* tmpdir = strdup(Malakite::temp_mkstemp_path); 1.18 mkdtemp(tmpdir); 1.19 @@ -237,6 +237,8 @@ 1.20 tempfile_check = temp_dir + "/check"; 1.21 tempfile_sh = temp_dir + "/run.sh"; 1.22 1.23 + temp_dirs.push_back(temp_dir); 1.24 + 1.25 std::ofstream alignment_file; 1.26 alignment_file.open(tempfile_alignment.c_str()); 1.27 alignment_file << alignment; 1.28 @@ -339,10 +341,10 @@ 1.29 1.30 void Blocks3DWidget::drop_tempfiles() 1.31 { 1.32 - if (!temp_dir.empty()) 1.33 + BOOST_FOREACH(std::string dir, temp_dirs) 1.34 { 1.35 - system((str(boost::format("/bin/rm -rf %s") % temp_dir)).c_str()); 1.36 - temp_dir = ""; 1.37 + system((str(boost::format("/bin/rm -rf %s") % dir)).c_str()); 1.38 + temp_dirs.clear(); 1.39 } 1.40 } 1.41
2.1 --- a/blocks3d/wt/blocks3d-wt-widget.h Sat Feb 26 18:06:45 2011 +0300 2.2 +++ b/blocks3d/wt/blocks3d-wt-widget.h Sat Feb 26 19:26:13 2011 +0300 2.3 @@ -2,6 +2,7 @@ 2.4 #define MALAKITE_BLOCKS3D_WIDGET_H_ 2.5 2.6 #include <string> 2.7 +#include <list> 2.8 2.9 #include <Wt/WContainerWidget> 2.10 #include <Wt/WFileUpload> 2.11 @@ -45,6 +46,7 @@ 2.12 Wt::WTimer* timer; 2.13 Worktime* worktime; 2.14 2.15 + std::list<std::string> temp_dirs; 2.16 std::string temp_dir; 2.17 std::string tempfile_alignment; 2.18 std::string tempfile_conformity;