diff --git a/gammapkt.cc b/gammapkt.cc index 3f3c2a012..19a619806 100644 --- a/gammapkt.cc +++ b/gammapkt.cc @@ -213,7 +213,10 @@ void init_photoion_data() { for (int Z = 0; Z < numb_xcom_elements; Z++) { photoion_data[Z].reserve(100); } - std::ifstream data_fs("xcom_photoion_data.txt"); + const std::string filepath{"xcom_photoion_data.txt"}; + assert_always(std::filesystem::exists(filepath)); + + std::ifstream data_fs(filepath); std::string line_str; // now read the file a second time to store the data while (getline(data_fs, line_str)) {