1
0
mirror of synced 2025-01-18 09:04:52 +01:00

fix: File load achievement triggering every time a file was opened through the cli

This commit is contained in:
WerWolv 2023-10-17 13:45:12 +02:00
parent 8821f75e6b
commit 58870f3057
2 changed files with 8 additions and 5 deletions

View File

@ -1,10 +1,12 @@
#include <hex/api/event.hpp> #include <hex/api/event.hpp>
#include <hex/api/localization.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/ui/view.hpp> #include <hex/ui/view.hpp>
#include <hex/api/localization.hpp>
#include <hex/helpers/logger.hpp> #include <hex/helpers/logger.hpp>
#include <hex/api/project_file_manager.hpp>
#include <imgui.h> #include <imgui.h>
@ -105,8 +107,11 @@ namespace hex::plugin::builtin {
newProvider->setPath(path); newProvider->setPath(path);
if (!newProvider->open()) if (!newProvider->open())
hex::ImHexApi::Provider::remove(newProvider); hex::ImHexApi::Provider::remove(newProvider);
else else {
EventManager::post<EventProviderOpened>(newProvider); EventManager::post<EventProviderOpened>(newProvider);
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.open_file.name");
}
} }
}); });
} else if (name == "Open Project") { } else if (name == "Open Project") {

View File

@ -265,8 +265,6 @@ namespace hex::plugin::builtin {
this->m_file.close(); this->m_file.close();
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.open_file.name");
return true; return true;
} }