t/common: Switch SimulaVR builder to u_file_read_content_from_path

This commit is contained in:
Moses Turner 2022-09-18 08:03:21 -05:00
parent d04139bedd
commit e8225b273c

View file

@ -82,13 +82,11 @@ process_poly_values(const cJSON *values, struct svr_display_distortion_polynomia
static bool static bool
process_config(const char *config_path, struct svr_two_displays_distortion *out_dist) process_config(const char *config_path, struct svr_two_displays_distortion *out_dist)
{ {
FILE *file = fopen(config_path, "r"); char *file_content = u_file_read_content_from_path(config_path);
const char *file_content = u_file_read_content(file); if (file_content == NULL) {
int ret = fclose(file); U_LOG_E("The file at \"%s\" was unable to load. Either there wasn't a file there or it was empty.",
if (ret != 0) { config_path);
// Apparently I have to handle this. I have no idea how this could happen or if it would be bad, so return false;
// let's print and keep going.
U_LOG_E("Failed to close file?");
} }
cJSON *config_json = cJSON_Parse(file_content); cJSON *config_json = cJSON_Parse(file_content);