27 if (!std::filesystem::exists(path)) {
28 throw std::runtime_error(
"no file exists");
31 if constexpr(std::is_same<Path_, std::filesystem::path>::value) {
32 if constexpr(std::is_same<typename Path_::value_type, char>::value) {
34 return H5::H5File(path.c_str(), H5F_ACC_RDONLY);
37 return H5::H5File(path.string(), H5F_ACC_RDONLY);
40 return H5::H5File(path, H5F_ACC_RDONLY);
42}
catch (H5::Exception& e) {
43 std::string message =
"failed to open the HDF5 file at '";
44 if constexpr(std::is_same<Path_, std::filesystem::path>::value) {
45 message += path.string();
49 message +=
"'; " + e.getDetailMsg();
50 throw std::runtime_error(message);