2016-06-10 15:41:13 +02:00
|
|
|
#include "oshelper.h"
|
|
|
|
#include <QTemporaryFile>
|
|
|
|
#include <QDir>
|
2017-01-03 21:44:55 +01:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QString>
|
2016-06-10 15:41:13 +02:00
|
|
|
|
|
|
|
OSHelper::OSHelper(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString OSHelper::temporaryFilename() const
|
|
|
|
{
|
|
|
|
QString tempFileName;
|
|
|
|
{
|
|
|
|
QTemporaryFile f;
|
|
|
|
f.open();
|
|
|
|
tempFileName = f.fileName();
|
|
|
|
}
|
|
|
|
return tempFileName;
|
|
|
|
}
|
|
|
|
|
2017-01-03 21:44:55 +01:00
|
|
|
bool OSHelper::removeTemporaryWallet(const QString &fileName) const
|
|
|
|
{
|
|
|
|
// Temporary files should be deleted automatically by default, in case they wouldn't, we delete them manually as well
|
|
|
|
bool cache_deleted = QFile::remove(fileName);
|
|
|
|
bool address_deleted = QFile::remove(fileName + ".address.txt");
|
|
|
|
bool keys_deleted = QFile::remove(fileName +".keys");
|
|
|
|
|
|
|
|
return cache_deleted && address_deleted && keys_deleted;
|
|
|
|
}
|
|
|
|
|
2016-06-10 15:41:13 +02:00
|
|
|
QString OSHelper::temporaryPath() const
|
|
|
|
{
|
|
|
|
return QDir::tempPath();
|
|
|
|
}
|