mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-20 12:52:06 +03:00
36 lines
528 B
C++
36 lines
528 B
C++
|
#include <cstdlib>
|
||
|
#include <cerrno>
|
||
|
#include <cstring>
|
||
|
|
||
|
#include <QDebug>
|
||
|
|
||
|
#include "mirall/temporarydir.h"
|
||
|
#include "mirall/fileutils.h"
|
||
|
|
||
|
namespace Mirall
|
||
|
{
|
||
|
|
||
|
static char dir_template[] = "/tmp/mirall-XXXXXX";
|
||
|
|
||
|
TemporaryDir::TemporaryDir()
|
||
|
{
|
||
|
char *tmp = ::mkdtemp(dir_template);
|
||
|
_path = QString((const char *) tmp);
|
||
|
|
||
|
//qDebug() << "tmp:" << _path;
|
||
|
//qDebug() << strerror(errno);
|
||
|
|
||
|
}
|
||
|
|
||
|
TemporaryDir::~TemporaryDir()
|
||
|
{
|
||
|
FileUtils::removeDir(_path);
|
||
|
}
|
||
|
|
||
|
QString TemporaryDir::path() const
|
||
|
{
|
||
|
return _path;
|
||
|
}
|
||
|
|
||
|
}
|