2025-01-10 21:33:48 +01:00
|
|
|
#include <QFile>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QUuid>
|
|
|
|
#include <QtCore/QStandardPaths>
|
2025-01-29 16:42:37 +01:00
|
|
|
#include <memory>
|
2025-01-10 21:33:48 +01:00
|
|
|
#include <quazip5/JlCompress.h>
|
|
|
|
|
2025-01-29 16:42:37 +01:00
|
|
|
#include "passphraseprovider.h"
|
2025-01-10 21:33:48 +01:00
|
|
|
#include "utils.h"
|
|
|
|
|
2025-01-29 16:42:37 +01:00
|
|
|
TestsUtils::TestsUtils():
|
|
|
|
m_passphrase_povider(std::unique_ptr<TesTPassphraseProvider>(new TesTPassphraseProvider()))
|
|
|
|
{}
|
|
|
|
|
2025-01-10 21:33:48 +01:00
|
|
|
|
2025-01-13 18:11:16 +01:00
|
|
|
QString TestsUtils::getTempPath()
|
|
|
|
{
|
2025-01-10 21:33:48 +01:00
|
|
|
// Get the system's temporary directory
|
2025-01-29 16:42:37 +01:00
|
|
|
QString tempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
2025-01-10 21:33:48 +01:00
|
|
|
|
|
|
|
// Generate a unique UUID
|
|
|
|
QString uuid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
|
|
|
|
|
|
|
// Create a new directory using the generated UUID
|
|
|
|
QString newTempDir = tempDir + "/" + uuid;
|
|
|
|
|
|
|
|
QDir dir;
|
2025-01-29 16:42:37 +01:00
|
|
|
dir.mkpath(newTempDir);
|
|
|
|
|
|
|
|
qDebug() << "TempDir : " << newTempDir;
|
|
|
|
return newTempDir;
|
2025-01-10 21:33:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-01-29 16:42:37 +01:00
|
|
|
QObject* TestsUtils::getTestPassphraseProvider()
|
|
|
|
{
|
|
|
|
return this->m_passphrase_povider.get();
|
|
|
|
}
|
|
|
|
|
2025-01-10 21:33:48 +01:00
|
|
|
|