-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConfig.cpp
More file actions
27 lines (22 loc) · 794 Bytes
/
Config.cpp
File metadata and controls
27 lines (22 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "Config.h"
#include <nlohmann/json.hpp>
Config::Config() {
if (!std::filesystem::exists("../VMHelp.json")) {
std::fstream file;
file.open("../VMHelp.json", std::ios::out);
nlohmann::json config;
config["isDebug"] = config_.isDebug;
config["max_trace_num_once"] = config_.max_trace_num_once;
config["trace_log_path"] = config_.trace_log_path;
file << config.dump(4);
file.close();
}
std::fstream file;
file.open("../VMHelp.json", std::ios::in);
nlohmann::json config;
file >> config;
config_.isDebug = config["isDebug"];
config_.max_trace_num_once = config["max_trace_num_once"];
config_.trace_log_path = config["trace_log_path"];
file.close();
}