clear();
// if file was opened, read the parameter values
- if (fs::exists(para_file_path))
+ if (not fs::exists(para_file_path))
{
+ throw mussa_load_error("Config File: " + para_file_path.string() + " not found");
+ } else if (fs::is_directory(para_file_path)) {
+ throw mussa_load_error("Config File: " + para_file_path.string() + " is a directory.");
+ } else if (fs::is_empty(para_file_path)) {
+ throw mussa_load_error("Config File: " + para_file_path.string() + " is empty");
+ } else {
para_file.open(para_file_path, ios::in);
// what directory is the mupa file in?
param = file_data_line.substr(0,split_index);
value = file_data_line.substr(split_index+1);
- while (!para_file.eof())
+ while (para_file)
{
did_seq = false;
if (param == "ANA_NAME")
sub_seq_end = 0;
seq_params = true;
- while ((!para_file.eof()) && seq_params)
+ while (para_file && seq_params)
{
getline(para_file,file_data_line);
split_index = file_data_line.find(" ");
// << " threshold = " << threshold << endl;
}
// no file was loaded, signal error
- else
- {
- throw mussa_load_error("Config File: " + para_file_path.string() + " not found");
- }
dirty = true;
}