This commit is contained in:
arm64v8a 2022-11-30 10:30:07 +09:00
parent 11e8f66d88
commit 3163b3e1aa
2 changed files with 6 additions and 1 deletions

View File

@ -17,11 +17,12 @@ namespace NekoRay {
}
void ProfileManager::LoadManager() {
QList<int> invaild_profile_id;
for (auto id: _profiles) {
auto ent = LoadProxyEntity(QString("profiles/%1.json").arg(id));
if (ent == nullptr || ent->bean == nullptr || ent->bean->version == -114514) {
// clear invaild profile
DeleteProfile(id);
invaild_profile_id << id;
continue;
}
profiles[id] = ent;
@ -29,6 +30,9 @@ namespace NekoRay {
for (auto id: _groups) {
groups[id] = LoadGroup(QString("groups/%1.json").arg(id));
}
for (auto id: invaild_profile_id) {
DeleteProfile(id);
}
}
void ProfileManager::SaveManager() {

View File

@ -4,6 +4,7 @@
#include <QFile>
#include <QDir>
#include <QFileInfo>
#include <QUrl>
#define WriteTempFile(fn, data) \
QDir dir; \