You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
502 B
33 lines
502 B
#include "webfuse/core/string.h"
|
|
#include "webfuse/utils/tempdir.hpp"
|
|
|
|
#include <unistd.h>
|
|
#include <cstdlib>
|
|
#include <stdexcept>
|
|
|
|
namespace webfuse_test
|
|
{
|
|
|
|
TempDir::TempDir(char const * prefix)
|
|
: path_(wf_create_string("/tmp/%s_XXXXXX", prefix))
|
|
{
|
|
char * result = mkdtemp(path_);
|
|
if (NULL == result)
|
|
{
|
|
throw std::runtime_error("unable to create temp dir");
|
|
}
|
|
}
|
|
|
|
TempDir::~TempDir()
|
|
{
|
|
rmdir(path_);
|
|
free(path_);
|
|
}
|
|
|
|
char const * TempDir::path()
|
|
{
|
|
return path_;
|
|
}
|
|
|
|
|
|
} |