7#include "absl/strings/str_format.h"
10#include <nlohmann/json.hpp>
15namespace fs = std::filesystem;
19 std::ofstream file(
path_);
28 std::remove(
path_.c_str());
33 : path_(std::move(other.path_)) {
41 std::remove(path_.c_str());
43 path_ = std::move(other.path_);
50 if (
path_.empty())
return;
54 j[
"pid"] = status.
pid;
60 std::ofstream file(
path_);
66 std::ofstream file(
path_);
68 file << absl::StrFormat(
71 " \"version\": \"%s\",\n"
72 " \"socket_path\": \"%s\",\n"
73 " \"active_rom\": \"%s\",\n"
74 " \"start_timestamp\": %d\n"
Manages a JSON status file for instance discovery.
ActivityFile & operator=(const ActivityFile &)=delete
bool Exists() const
Check if the status file exists on disk.
ActivityFile(const std::string &path)
Construct an activity file at the specified path.
void Update(const ActivityStatus &status)
Update the status file with new information.
~ActivityFile()
Destructor removes the status file.
Status information for an active YAZE instance.