5#include <boost/filesystem.hpp>
13 explicit TempFile(boost::filesystem::path path) : m_path(path)
15 if(boost::filesystem::exists(path))
16 boost::filesystem::remove(path);
18 TempFile() : TempFile(static_cast<const char*>(nullptr))
22 explicit TempFile(
const char* ext)
24 std::string pattern(
"%%%%-%%%%-%%%%-%%%%.");
25 if(ext ==
nullptr || *ext==0){
31 m_path = boost::filesystem::temp_directory_path();
32 m_path /= boost::filesystem::unique_path(pattern);
34 const boost::filesystem::path& getPath()
const{
39 if(boost::filesystem::exists(m_path))
40 boost::filesystem::remove(m_path);
43 boost::filesystem::path m_path;
Definition: exceptions.hpp:12