diff --git a/src/FilePtr.cpp b/src/FilePtr.cpp index 45e65d46..f0e0844c 100644 --- a/src/FilePtr.cpp +++ b/src/FilePtr.cpp @@ -9,10 +9,10 @@ namespace aare { FilePtr::FilePtr(const std::filesystem::path &fname, const std::string &mode = "rb") { - fp_ = fopen(fname.c_str(), mode.c_str()); + fp_ = fopen(fname.string().c_str(), mode.c_str()); if (!fp_) throw std::runtime_error( - fmt::format("Could not open: {}", fname.c_str())); + fmt::format("Could not open: {}", fname.string())); } FilePtr::FilePtr(FilePtr &&other) { std::swap(fp_, other.fp_); } diff --git a/src/JungfrauDataFile.cpp b/src/JungfrauDataFile.cpp index 34820b8b..5c19cbc3 100644 --- a/src/JungfrauDataFile.cpp +++ b/src/JungfrauDataFile.cpp @@ -136,7 +136,7 @@ void JungfrauDataFile::find_frame_size(const std::filesystem::path &fname) { void JungfrauDataFile::parse_fname(const std::filesystem::path &fname) { m_path = fname.parent_path(); - m_base_name = fname.stem(); + m_base_name = fname.stem().string(); // find file index, then remove if from the base name if (auto pos = m_base_name.find_last_of('_'); pos != std::string::npos) { diff --git a/src/NumpyFile.cpp b/src/NumpyFile.cpp index 699fa08c..d70ae5bb 100644 --- a/src/NumpyFile.cpp +++ b/src/NumpyFile.cpp @@ -28,8 +28,7 @@ NumpyFile::NumpyFile(const std::filesystem::path &fname, throw std::runtime_error( fmt::format("Could not open: {} for reading", fname.string())); } - initial_header_len = aare::NumpyHelpers::write_header( - std::filesystem::path(fname.c_str()), m_header); + initial_header_len = aare::NumpyHelpers::write_header(fname, m_header); } m_pixels_per_frame = std::accumulate(m_header.shape.begin() + 1, m_header.shape.end(), 1, diff --git a/src/RawMasterFile.cpp b/src/RawMasterFile.cpp index e0880ba5..4259c899 100644 --- a/src/RawMasterFile.cpp +++ b/src/RawMasterFile.cpp @@ -11,8 +11,8 @@ namespace aare { RawFileNameComponents::RawFileNameComponents( const std::filesystem::path &fname) { m_base_path = fname.parent_path(); - m_base_name = fname.stem(); - m_ext = fname.extension(); + m_base_name = fname.stem().string(); + m_ext = fname.extension().string(); if (m_ext != ".json" && m_ext != ".raw") { throw std::runtime_error(LOCATION + diff --git a/src/RawSubFile.cpp b/src/RawSubFile.cpp index 7a42bbba..cd1a6fba 100644 --- a/src/RawSubFile.cpp +++ b/src/RawSubFile.cpp @@ -163,7 +163,7 @@ void RawSubFile::parse_fname(const std::filesystem::path &fname) { // f1 is the file index - thi is the one we need // 0 is the measurement index, will not change m_path = fname.parent_path(); - m_base_name = fname.filename(); + m_base_name = fname.filename().string(); // Regex to extract numbers after 'd' and 'f' std::regex pattern(R"(^(.*_d)(\d+)(_f)(\d+)(_\d+\.raw)$)");