|
|
@ -20,21 +20,20 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <boost/filesystem.hpp> |
|
|
|
#include <libdevcore/Exceptions.h> |
|
|
|
#include "ShortLivingDirectory.h" |
|
|
|
#include "Common.h" |
|
|
|
|
|
|
|
using namespace std; |
|
|
|
using namespace dev; |
|
|
|
using namespace dev::test; |
|
|
|
|
|
|
|
ShortLivingDirectory::ShortLivingDirectory() |
|
|
|
{ |
|
|
|
m_path = getRandomPath(); |
|
|
|
boost::filesystem::create_directories(m_path); |
|
|
|
} |
|
|
|
|
|
|
|
ShortLivingDirectory::ShortLivingDirectory(std::string const& _path) : m_path(_path) |
|
|
|
{ |
|
|
|
// we never ever want to delete a directory (including all its contents) that we did not create ourselves.
|
|
|
|
if (boost::filesystem::exists(m_path)) { |
|
|
|
BOOST_THROW_EXCEPTION(FileError()); |
|
|
|
} |
|
|
|
|
|
|
|
boost::filesystem::create_directories(m_path); |
|
|
|
} |
|
|
|
|
|
|
|