diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc index c18bb2e3a..140a64ba3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc @@ -253,7 +253,16 @@ 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; - fs::create_directories(config_path.parent_path()); + 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; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c index 7045ee2aa..26934bcaf 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c @@ -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; }