diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp index f2dbaa6..f596b85 100644 --- a/src/RagePhoto.cpp +++ b/src/RagePhoto.cpp @@ -27,6 +27,10 @@ #include #include +#if (RAGEPHOTO_CXX_STD >= 17) && (__cplusplus >= 201703L) +#include +#endif + #ifdef RAGEPHOTO_BENCHMARK #include #endif @@ -587,7 +591,11 @@ bool RagePhoto::load(const std::string &data) bool RagePhoto::loadFile(const std::string &filename) { +#if (RAGEPHOTO_CXX_STD >= 17) && (__cplusplus >= 201703L) + std::ifstream ifs(std::filesystem::u8path(filename), std::ios::in | std::ios::binary); +#else std::ifstream ifs(filename, std::ios::in | std::ios::binary); +#endif if (ifs.is_open()) { std::string sdata(std::istreambuf_iterator{ifs}, {}); ifs.close(); @@ -955,7 +963,11 @@ bool RagePhoto::saveFile(const std::string &filename, uint32_t photoFormat) bool ok; const std::string &sdata = save(photoFormat, &ok); if (ok) { +#if (RAGEPHOTO_CXX_STD >= 17) && (__cplusplus >= 201703L) + std::ofstream ofs(std::filesystem::u8path(filename), std::ios::out | std::ios::binary | std::ios::trunc); +#else std::ofstream ofs(filename, std::ios::out | std::ios::binary | std::ios::trunc); +#endif if (!ofs.is_open()) { m_data->error = Error::Uninitialised; // 0 return false;