src/io/io.cc
//! Check if a file is present
Check if a file is present
Check if a file is present
bool mpm::IO::check_file(const std::string& filename) {
  bool status = false;
  std::ifstream file;
  file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
  try {
    file.open(filename);
    status = true;
    file.close();
  } catch (std::exception& exception) {
    status = false;
    console_->error("Failed to find file {}: {}", filename, exception.what());
  }
  return status;
}
bool mpm :: IO :: check_file ( const std :: string & filename ) { bool status = false ; std :: ifstream file ; file . exceptions ( std :: ifstream :: failbit | std :: ifstream :: badbit ) ; try { file . open ( filename ) ; status = true ; file . close ( ) ; } catch ( std :: exception & exception ) { status = false ; console_ -> error ( " " , filename , exception . what ( ) ) ; } return status ; }
Check if a file is present
Check if a file is present
// Check if file is present