<< my_path_list.size() << " directories "
<< std::endl;
- // Try to open file
+ // Try to open file in the various directories we have
for (path = my_path_list.begin(); path != endp; ++path)
{
- real_name = *path + filename + suffix;
- if (debug > 1)
- deallog << "PathSearch[" << cls << "] trying "
- << real_name << std::endl;
- FILE *fp = fopen(real_name.c_str(), open_mode);
- if (fp != 0)
- {
- if (debug > 0)
- deallog << "PathSearch[" << cls << "] opened "
- << real_name << std::endl;
- fclose(fp);
- return real_name;
- }
+ // see if the file exists as given, i.e., with
+ // the whole filename specified, including (possibly)
+ // the suffix
+ {
+ real_name = *path + filename;
+ if (debug > 1)
+ deallog << "PathSearch[" << cls << "] trying "
+ << real_name << std::endl;
+ FILE *fp = fopen(real_name.c_str(), open_mode);
+ if (fp != 0)
+ {
+ if (debug > 0)
+ deallog << "PathSearch[" << cls << "] opened "
+ << real_name << std::endl;
+ fclose(fp);
+ return real_name;
+ }
+ }
+
+ // try again with the suffix appended
+ {
+ real_name = *path + filename + suffix;
+ if (debug > 1)
+ deallog << "PathSearch[" << cls << "] trying "
+ << real_name << std::endl;
+ FILE *fp = fopen(real_name.c_str(), open_mode);
+ if (fp != 0)
+ {
+ if (debug > 0)
+ deallog << "PathSearch[" << cls << "] opened "
+ << real_name << std::endl;
+ fclose(fp);
+ return real_name;
+ }
+ }
}
AssertThrow(false, ExcFileNotFound(filename, cls));
return std::string("");