Read version from file

This commit is contained in:
Eddoursul 2022-09-14 19:33:20 +02:00
parent 27d46d3033
commit bc7488c8d0
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1 @@
version = 2.0.12.3

View File

@ -2,6 +2,7 @@
#include "CheckInvalidForms.h" #include "CheckInvalidForms.h"
#include <SimpleIni.h> #include <SimpleIni.h>
#include <regex>
inline const SKSE::LoadInterface* GetLoadInterface(const SKSE::LoadInterface* loadInterface = nullptr) inline const SKSE::LoadInterface* GetLoadInterface(const SKSE::LoadInterface* loadInterface = nullptr)
{ {
@ -56,7 +57,23 @@ inline void SetINISettings()
inline void CheckIncompatibleMods() inline void CheckIncompatibleMods()
{ {
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v2.0.12 by Eddoursul and contributors"); bool bPrinted = false;
if (std::filesystem::exists("Data\\SKSE\\Plugins\\EnderalVersion.ini")) {
CSimpleIniA ini;
ini.SetUnicode(false);
ini.SetMultiKey(false);
ini.LoadFile("Data/SKSE/Plugins/EnderalVersion.ini");
const char* version = ini.GetValue("", "version", "2.0.x");
std::regex version_expr("^[\\d\\.]+$");
if (std::regex_match(version, version_expr)) {
RE::ConsoleLog::GetSingleton()->Print(std::format("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v{} by Eddoursul and contributors", version).c_str());
bPrinted = true;
}
}
if (!bPrinted) {
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v2.0.x by Eddoursul and contributors");
}
CheckBlacklist(); CheckBlacklist();
CheckWorldspaces(); CheckWorldspaces();