mirror of
https://github.com/chenx-dust/EZ4Connect.git
synced 2026-09-20 10:23:33 +08:00
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#include <QCoreApplication>
|
|
#include <QDebug>
|
|
#include <QFileInfo>
|
|
#include <QTemporaryDir>
|
|
|
|
#include "infrastructure/settings/profilemanager.h"
|
|
|
|
namespace
|
|
{
|
|
bool createsPhysicalFilesForEmptyProfiles()
|
|
{
|
|
QTemporaryDir directory;
|
|
ProfileManager manager(directory.path());
|
|
|
|
if (!manager.activeProfile().isEmpty()
|
|
|| !QFileInfo::exists(manager.profilePath(""))
|
|
|| !manager.setActiveProfile(""))
|
|
{
|
|
qCritical() << "default profile file was not created";
|
|
return false;
|
|
}
|
|
|
|
const QString profileId = manager.createProfile("empty");
|
|
if (profileId != "empty"
|
|
|| !QFileInfo::exists(manager.profilePath(profileId))
|
|
|| !manager.listProfiles().contains(profileId)
|
|
|| !manager.setActiveProfile(profileId))
|
|
{
|
|
qCritical() << "empty named profile file was not created";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication application(argc, argv);
|
|
return createsPhysicalFilesForEmptyProfiles() ? 0 : 1;
|
|
}
|