2020-02-20 17:04:56 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <ctime>
|
|
|
|
|
#include <optional>
|
2020-04-21 10:30:12 +03:00
|
|
|
#include <functional>
|
2020-02-20 17:04:56 +03:00
|
|
|
|
2020-04-21 10:30:12 +03:00
|
|
|
// All fields must be default-initialized
|
2020-02-20 17:04:56 +03:00
|
|
|
struct UpdateState
|
|
|
|
|
{
|
|
|
|
|
std::optional<std::time_t> github_update_last_checked_date;
|
2020-04-21 10:30:12 +03:00
|
|
|
bool pending_update = false;
|
2020-06-18 13:43:09 +03:00
|
|
|
std::wstring pending_installer_filename;
|
2020-02-20 17:04:56 +03:00
|
|
|
|
2020-04-21 10:30:12 +03:00
|
|
|
// To prevent concurrent modification of the file, we enforce this interface, which locks the file while
|
|
|
|
|
// the state_modifier is active.
|
|
|
|
|
static void store(std::function<void(UpdateState&)> state_modifier);
|
|
|
|
|
static UpdateState read();
|
2020-02-20 17:04:56 +03:00
|
|
|
};
|