>From 51dcd8d9dbadbbc8765cfcde4d248d3c0cd1e1c3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Dec 2014 23:02:24 +0100 Subject: [PATCH 5/5] Clean up .fo.xml files created during PDF generation in the test. The PDF generation process produces not only the .pdf files, but also .fo.xml ones as a side effect. Delete these files to avoid littering the print directory with them. --- wx_test_pdf_create.cpp | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/wx_test_pdf_create.cpp b/wx_test_pdf_create.cpp index bbb1dd2..fcbc96a 100644 --- a/wx_test_pdf_create.cpp +++ b/wx_test_pdf_create.cpp @@ -61,7 +61,9 @@ // Specialized version of output_file_existence_checker for the output PDF // files: it takes just the base name of the file, without neither the -// directory part nor the .pdf extension, in its ctor. +// directory part nor the .pdf extension, in its ctor and also takes care of +// deleting the .fo.xml created as a side effect of PDF generation when the PDF +// file itself is removed. class output_pdf_existence_checker :public output_file_existence_checker { public: @@ -69,7 +71,26 @@ class output_pdf_existence_checker :public output_file_existence_checker :output_file_existence_checker (make_full_print_path(base_name + ".pdf") ) + ,fo_xml_path_ + (make_full_print_path(base_name + ".fo.xml") + ) { + // We do not remove .fo.xml file here, this is unnecessary as we don't + // particularly care whether it exists or not because we never check + // for its existence. + } + + ~output_pdf_existence_checker() + { + // Do remove the .fo.xml file to avoid littering the print directory + // with the files generated during the test run. + try + { + fs::remove(fo_xml_path_); + } + catch(...) + { + } } private: @@ -81,6 +102,8 @@ class output_pdf_existence_checker :public output_file_existence_checker p /= leaf; return p; } + + fs::path fo_xml_path_; }; } // Unnamed namespace. -- 1.7.9