mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-12 05:08:56 +02:00
add prompt and function for auto update override settings
This commit is contained in:
parent
2e7832762e
commit
d5be379a45
5 changed files with 39 additions and 1 deletions
|
|
@ -516,7 +516,25 @@ s.setting.SetValue(new_value); \
|
|||
}
|
||||
|
||||
std::optional<std::uint32_t> GetOverridesFileVersion() {
|
||||
// later used for/if download check override version
|
||||
const auto path = GetOverridesPath();
|
||||
std::ifstream file(path);
|
||||
if (!file.is_open()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string line;
|
||||
if (std::getline(file, line)) {
|
||||
line = Trim(line);
|
||||
if (line.starts_with(kVersionPrefix)) {
|
||||
const auto version_str = line.substr(std::strlen(kVersionPrefix));
|
||||
std::uint32_t version = 0;
|
||||
auto [ptr, ec] = std::from_chars(version_str.data(),
|
||||
version_str.data() + version_str.size(), version);
|
||||
if (ec == std::errc{}) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue