1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-16 04:05:46 +00:00

Fix volk_gnsssdr_profile if config file does not exist

This commit is contained in:
Carles Fernandez 2019-06-03 01:30:39 +02:00
parent c89247026a
commit edbe7b4840
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 19 additions and 1 deletions

View File

@ -253,8 +253,17 @@ void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool
if (!fs::exists(config_path.parent_path()))
{
std::cout << "Creating " << config_path.parent_path() << " ..." << std::endl;
try
{
fs::create_directories(config_path.parent_path());
}
catch (const fs::filesystem_error &e)
{
std::cerr << "ERROR: Could not create folder " << config_path.parent_path() << std::endl;
std::cerr << "Reason: " << e.what() << std::endl;
return;
}
}
std::ofstream config;
if (update_result)

View File

@ -77,6 +77,15 @@ void volk_gnsssdr_get_config_path(char *path)
return;
}
// if nothing exists, write to HOME or APPDATA
home = getenv("HOME");
if (home == NULL) home = getenv("APPDATA");
if (home != NULL)
{
strncpy(path, home, 512);
strcat(path, suffix);
return;
}
path[0] = 0;
return;
}