Closed stream

This commit is contained in:
PaulCombal 2020-02-18 14:55:30 +01:00
parent 65d25d92b0
commit f07600e620
2 changed files with 24 additions and 2 deletions

View File

@ -164,9 +164,16 @@ SteamAppDAO::parse_app_names(const std::string file_path, std::map<AppId_t, std:
yajl_val node;
char errbuf[1024];
std::string file_contents;
std::ifstream stream(file_path);
if (!stream.is_open())
{
std::cerr << "SteamAppDAO::parse_app_names: Unable to open file " << file_path << std::endl;
zenity();
exit(EXIT_FAILURE);
}
try {
std::ifstream stream(file_path);
std::stringstream buffer;
buffer << stream.rdbuf();
file_contents = buffer.str();
@ -176,6 +183,8 @@ SteamAppDAO::parse_app_names(const std::string file_path, std::map<AppId_t, std:
exit(EXIT_FAILURE);
}
stream.close();
/* we have the whole config file in memory. let's parse it ... */
node = yajl_tree_parse(file_contents.c_str(), errbuf, sizeof(errbuf));

View File

@ -76,8 +76,21 @@ Server --> Client
.
.
.
],
STAT_LIST_STR:
[
{
STAT_DISPLAY_STR: "desc",
STAT_ID_STR: "ID",
STAT_INCREMENTONLY_STR: true/false,
STAT_PERMISSION_STR: <int value>,
STAT_TYPE_STR: <int cast of UserStatType>,
STAT_VALUE_STR: <int or float>
},
.
.
.
]
// THERE MUST BE STATS HERE TOO TODO
}
# 2. Lock or unlock an achievement for active game